C Programming Interview Questions

Ques. What are the key features of C programming language?

Ans. C is a platform-dependent language. C offers the possibility to break down a large program into small modules. Also, the possibility of a programmer to control the language. C comes with support for system programming and hence it compiles and executes with high speed when compared to other high-level languages.

Ques. What is the use of header files in C?

Ans. Header files contain the definitions and set of rules of the functions being used in the programs. For example, when you use printf() or scanf() in your program, you nee to include stdio.h library function. Else your compiler will show an error. This is because, the standard input and output functions printf() and scanf() are stored in this header file. So similarly every header file stores a set of predefined functions which makes it easy to program.

Ques. What is Memory Leak in C?

Ans. A memory leak occurs when programmers create a memory in the heap and forget to delete it. It decreases the efficiency of the performance of the system.

Ques. What is the difference between ++a and a++?

Ans. ‘++a’ is called prefix increment. First, the value stored in the variable ‘a’ gets incremented and then gets assigned to the same variable. Whereas, ‘a++’ is called postfix increment. The value stored in the variable ‘a’ gets incremented after the execution of the particular line.

Ques. What is a Dangling Pointer in C?

Ans. A pointer pointing to a dereferenced memory location is called dangling pointer. i.e. pointer pointing to the memory location which is deleted. There are three different ways where a pointer can act as a dangling pointer. De-allocation of memory When the local variable is not static When the variable goes out of scope

Post Question