C Language Interview Questions & Answers

Showing 10 of 130 questions | Page 3

Technical interview questions and answers are essential for clearing a C Language Interview because C is the foundation of all modern programming languages. C interviews typically include questions related to pointers, loops, functions, arrays, memory allocation, structures, and file handling. Whether you are preparing for campus placements or software development roles, companies such as TCS, Wipro, Infosys, Cognizant, and Accenture frequently test your C programming basics. This guide includes the most frequently asked C Language interview questions with clear explanations to help freshers and job seekers build strong conceptual understanding. Learning these questions will help you perform confidently in coding rounds, written tests, and technical interviews.

C programmers should advance their skills by learning C++ programming  and mastering data structures  for algorithm development 

Showing 10 of 130 questions

21. How can I read/write structures from/to data files?

It is relatively straightforward to use fread and fwrite.

22. How can I turn off structure padding?

There is no standard method.

23. Why does sizeof report a larger size than I expect for a structure type?

The alignment of arrays of structures must be preserved.

24. How can I determine the byte offset of a field within a structure?

ANSI C defines the offsetof() macro, which should be used if available.

25. How can I access structure fields by name at run time?

Build a table of names and offsets, using the offsetof() macro.

26. I have a program which works correctly, but dumps core after it finishes. Why?

Check to see if a structure type declaration just before main() is missing its trailing semicolon, causing main() to be declared as returning a structure. See also questions 10.9 and 16.4.

27. Can I initialize unions?

ANSI Standard C allows an initializer for the first-named member.

28. What is the difference between an enumeration and a set of preprocessor #defines?

At the present time, there is little difference. The C Standard states that enumerations are compatible with integral types.

29. Is there an easy way to print enumeration values symbolically?

No.

30. Why doesn't the code "a[i] = i++;" work?

The variable i is both referenced and modified in the same expression.
Questions and Answers for Competitive Exams Various Entrance Test