C Language Interview Questions and Answers - 4

Question: 16

Can array subscripts have negative value in C?

No. Array subscripts should not have negative value. Always, it should be positive.

 

Question: 17

What is pragma in C?

#pragma is a pre processor macro in C.

It is used to call a function before and after main function in a C program.

Question: 18

What is null pointer in C?

Null pointer is a pointer which is pointing to nothing. Null pointer points to empty location in memory.

Value of null pointer is 0. We can make a pointer to point to null as below.

int * p = NULL;

char * p = NULL;

Question: 19

What is the difference between= and== operator?

Where = is an assignment operator and == is a relational operator.

Example:

while (i=5) is an infinite loop because it is a non zero value and

while (i==5) is true  only when i=5.

Question: 20

What is the difference between printf(), sprintf() and fprintf()?

printf() is used to print the text or value of the variable in the screen .

sprintf() is used to store the values in the character array or string.

fprintf() is used to store the values of variable in the  file.

Related Questions