C Language Interview Questions & Answers

C Language Interview Online Test

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 

1. How do you decide which integer type to use?

Show Answer

2. What should the 64-bit type on new, 64-bit machines be?

Show Answer

3. What's the best way to declare and define global variables?

Show Answer

4. What does extern mean in a function declaration?

Show Answer

5. What's the auto keyword good for?

Show Answer

6. I can't seem to define a linked list node which contains a pointer to itself.

Show Answer

7. How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

Show Answer

8. How can I declare a function that returns a pointer to a function of its own type?

Show Answer

9. My compiler is complaining about an invalid redeclaration of a function, but I only define it once.

Show Answer

10. What can I safely assume about the initial values of variables which are not explicitly initialized?

Show Answer

11. Why can't I initialize a local array with a string?

Show Answer

12. What's wrong with "char *p = malloc(10);" ?

Show Answer

13. What is the difference between char a[] = "string"; and char *p = "string"; ?

Show Answer

14. How do I initialize a pointer to a function?

Show Answer

15. What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ?

Show Answer

16. What's the best way of implementing opaque (abstract) data types in C?

Show Answer

17. I came across some code that declared a structure with the last member an array of one element, and then did some tricky allocation to make it act like the array had several elements.Is this legal or portable?

Show Answer

18. Why can't you compare structures?

Show Answer

19. How are structure passing and returning implemented?

Show Answer

20. Can I pass constant values to functions which accept structure arguments?

Show Answer

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

Show Answer

22. How can I turn off structure padding?

Show Answer

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

Show Answer

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

Show Answer

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

Show Answer

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

Show Answer

27. Can I initialize unions?

Show Answer

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

Show Answer

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

Show Answer

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

Show Answer

31. Under my compiler, the code "int i = 7;printf("%d\n", i++ * i++);" prints 49. Regardless of the order of evaluation, shouldn't it print 56?

Show Answer

32. How could the code "int i = 3; i = i++;" ever give 7?

Show Answer

33. Don't precedence and parentheses dictate order of evaluation?

Show Answer

34. But what about the && and || operators?

Show Answer

35. What's a "sequence point"?

Show Answer

36. So given a[i] = i++; we don't know which cell of a[] gets written to, but i does get incremented by one, right?

Show Answer

37. If I'm not using the value of the expression, should I use i++ or ++i to increment a variable?

Show Answer

38. Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?

Show Answer

39. Can I use ?: on the left-hand side of an assignment expression?

Show Answer

40. What's wrong with "char *p; *p = malloc(10);"?

Show Answer

41. Does *p++ increment p, or what it points to?

Show Answer

42. I have a function which accepts, and is supposed to initialize,a pointer, but the pointer in the caller remains unchanged.

Show Answer

43. I have a function which accepts a pointer to an int. How can I pass a constant like 5 to it?

Show Answer

44. Does C even have "pass by reference"?

Show Answer

45. I've seen different methods used for calling functions via pointers

Show Answer

46. What is this infamous null pointer, anyway?

Show Answer

47. How do I get a null pointer in my programs?

Show Answer

48. Is the abbreviated pointer comparison "if(p)" to test for non-null pointers valid?

Show Answer

49. What is NULL and how is it #defined?

Show Answer

50. How should NULL be defined on a machine which uses a nonzero bit pattern as the internal representation of a null pointer?

Show Answer

51. What does static variable mean?

Show Answer

52. What is a pointer?

Show Answer

53. What is a structure?

Show Answer

54. What is a union?

Show Answer

55. What are the differences between structures and union?

Show Answer

56. What are the differences between structures and arrays?

Show Answer

57. In header files whether functions are declared or defined?

Show Answer

58. What are the differences between malloc () and calloc ()?

Show Answer

59. What are macros? What are its advantages and disadvantages?

Show Answer

60. Difference between pass by reference and pass by value?

Show Answer

61. What is static identifier?

Show Answer

62. Where is the auto variables stored?

Show Answer

63. Where does global, static, and local, register variables, free memory and C Program instructions get stored?

Show Answer

64. Difference between arrays and linked list?

Show Answer

65. What are enumerations?

Show Answer

66. What are register variables? What are the advantages of using register variables?

Show Answer

67. What is the use of typedef?

Show Answer

68. Can we specify variable field width in a scanf() format string? If possible how?

Show Answer

69. Out of fgets() and gets() which function is safe to use and why?

Show Answer

70. Difference between strdup and strcpy?

Show Answer

71. What is recursion?

Show Answer

72. Differentiate between for loop and a while loop? What are it uses?

Show Answer

73. What is storage class? What are the different storage classes in C?

Show Answer

74. What the advantages of using Unions?

Show Answer

75. What is the difference between Strings and Arrays?

Show Answer

76. What is a far pointer? Where we use it?

Show Answer

77. What is a huge pointer?

Show Answer

78. What is a normalized pointer, how do we normalize a pointer?

Show Answer

79. What is near pointer?

Show Answer

80. In C, why is the void pointer useful? When would you use it?

Show Answer

81. What is a NULL Pointer? Whether it is same as an uninitialized pointer?

Show Answer

82. Are pointers integer?

Show Answer

83. What does the error ‘Null Pointer Assignment means and what causes this error?

Show Answer

84. What is generic pointer in C?

Show Answer

85. Are the expressions arr and &arr same for an array of integers?

Show Answer

86. IMP>How pointer variables are initialized?

Show Answer

87. What is static memory allocation?

Show Answer

88. What is dynamic memory allocation?

Show Answer

89. What is the purpose of realloc?

Show Answer

90. What is an array of pointers?

Show Answer

91. Difference between linker and linkage?

Show Answer

92. Is it possible to have negative index in an array?

Show Answer

93. Why is it necessary to give the size of an array in an array declaration?

Show Answer

94. What modular programming?

Show Answer

95. What is a function?

Show Answer

96. What is an argument?

Show Answer

97. What are built in functions?

Show Answer

98. Difference between formal argument and actual argument?

Show Answer

99. Is it possible to have more than one main() function in a C program ?

Show Answer

100. What is the difference between an enumeration and a set of pre-processor # defines?

Show Answer

101. How are Structure passing and returning implemented by the complier?

Show Answer

102. what is the similarity between a Structure, Union and enumeration?

Show Answer

103. Can a Structure contain a Pointer to itself?

Show Answer

104. How can we read/write Structures from/to data files?

Show Answer

105. Write a program which employs Recursion?

Show Answer

106. Write a program which uses Command Line Arguments?

Show Answer

107. What do the ‘c and ‘v in argc and argv stand for?

Show Answer

108. what are C tokens?

Show Answer

109. What are C identifiers?

Show Answer

110. What is preincrement and post increment?

Show Answer

111. What is the maximum combined length of command line arguments including the space between adjacent arguments?

Show Answer

112. What is the difference between the functions memmove() and memcpy()?

Show Answer

113. What is a file?

Show Answer

114. what are the types of file?

Show Answer

115. what is a stream?

Show Answer

116. What is meant by file opening?

Show Answer

117. What is FILE?

Show Answer

118. What is a file pointer?

Show Answer

119. How is a file closed ?

Show Answer

120. Are the expressions *ptr ++ and ++ *ptr same?

Show Answer

121. What would be the equivalent pointer expression foe referring the same element as a[p][q][r][s] ?

Show Answer

122. Are the variables argc and argv are always local to main?

Show Answer

123. Can main () be called recursively?

Show Answer

124. IMP>Can we initialize unions?

Show Answer

125. whats the difference between these two declarations?

Show Answer

126. Why doesnt this code: a[i] = i++; work?

Show Answer

127. WHy doesnt struct x { … }; x thestruct; work?

Show Answer

128. Why cant we compare structures?

Show Answer

129. Can we use any name in place of argv and argc as command line arguments ?

Show Answer

130. What is the difference between an Interface and an Abstract class?

Show Answer
Questions and Answers for Competitive Exams Various Entrance Test