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
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?
The operations implied by the postincrement and postdecrement operators ++ and -- are performed at some time after the operand's former values are yielded and before the end of the expression, but not necessarily immediately after, or before other parts of the expression are evaluated.
32. How could the code "int i = 3; i = i++;" ever give 7?
Undefined behavior means *anything* can happen.
33. Don't precedence and parentheses dictate order of evaluation?
Operator precedence and explicit parentheses impose only a partial ordering on the evaluation of an expression, which does not generally include the order of side effects.
34. But what about the && and || operators?
There is a special exception for those operators: left-to-right evaluation is guaranteed.
35. What's a "sequence point"?
The point (at the end of a full expression, or at the ||, &&,?:, or comma operators, or just before a function call) at which all side effects are guaranteed to be complete.
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?
*No.* Once an expression or program becomes undefined, *all* aspects of it become undefined.
37. If I'm not using the value of the expression, should I use i++ or ++i to increment a variable?
Since the two forms differ only in the value yielded, they are entirely equivalent when only their side effect is needed.
38. Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?
You must manually cast one of the operands to (long).
39. Can I use ?: on the left-hand side of an assignment expression?
No.
40. What's wrong with "char *p; *p = malloc(10);"?