C-Language Interview Questions
1 .
Explain the meaning of queue and FIFO in C programming?
Queue is a kind of data structure present in the C programming and all the data present in this queue is stored in the format called FIFO. The full form of FIFO is first-in-first-out. In every queue, the first data is available on the first line.
2 .
Is it possible to print “Hello World” without semicolon in C? How?
Yes. It is possible to print “Hello World” without semicolon in C program. Please refer below example program.
This program prints “Hello World” in console window and returns 11 which is the value of string length.
#include <stdio.h>
int main()
  if(printf(“Hello World”))
  /* Do nothing */
3 .
What is meant by segmentation fault or memory fault in C?
Segmentation fault is a fault that occurs because of illegal/invalid memory access. Illegal memory access means, When a program tries to access a memory location that is not allowed or when a program tries to access a memory location in a way that is not allowed.
4 .
What is the difference between strcpy() and strncpy() functions in C?
strcpy( ) function copies whole content of one string into another string. Whereas, strncpy( ) function copies portion of contents of one string into another string.

If destination string length is less than source string, entire/specified source string value won’t be copied into destination string in both cases.
5 .
Is it possible to call atexit() function more than once in a C program?
Yes. We can call atexit() function more than once. But, they will be executed in reverse order as a stack.
Example Program : 
#include <stdio.h> 
#include <stdlib.h>
void Exit1 (void)
   printf ("Exit1 function is called\n");
void Exit2 (void)
   printf ("Exit2 function is called \n");
int main (void)
   atexit (Exit1);
   atexit (Exit2);
   printf ("This is the end of this program.\n");
   return 0;
Output :
This is the end of this program.
Exit2 function is called
Exit1 function is called
6 .
What is the use of “goto” statement?
goto statement is used to transfer the normal flow of a program to the specified label in the program. Below is the syntax for goto statement in C.
goto label;
7 .
What are header files in C?
Header files are those which contain C function declaration and macro definitions that are to be shared between sourced files. Header files are generated with the extension .h.
There are two types of header files:
* Programmer generated a header file
* Files that come with your compiler

Syntax: #include <file>
8 .
What is dynamic memory allocation in C?
Dynamic memory allocation is the process of memory allocation at the run time. There are a group of functions in C used to dynamic memory management i.e. calloc(), malloc(), realloc() and free().
9 .
How to write a program in C for swapping two numbers without the use of the third variable?
#include <stdio.h>
int main()
   int x, y; 
   printf(“Input two integers (x & y) to swap\n”);
   scanf(“%d%d”, &x, &y);
   x = x + y;
   y = x – y;
   x = x – y;
   printf(“x = %d\ny = %d\n”,x,y);
   return 0;
10 .
When is the arrow operator used?
Arrow operator is used to accessing elements in structure and union. It is used with a pointer variable. Arrow operator is formed by using a minus sign followed by a greater than a symbol.
Syntax :