Top 85 C Programming Interview Questions for Freshers and Pros

Hey Guys, so we have completed with C Programming series, and in this module, we are going to discuss the Top 85 C Programming Interview Questions for freshers and Pros, what are the main and important questions that are frequently asked in interviews, so let’s see.

C Programming Interview Questions

Since, C is the oldest programming language it has become the inspiration for many other programming languages like C++, Java, Python, etc. and it is considered as the origin of many programming languages. So, if you are preparing for C Interview, then you are exactly in the right place to get all these things.

C Programming Interview Questions

List of Top 25 C Programming Interview Questions for Freshers

So, here is the list of questions with answers that are frequently asked in C programming interviews.

List of Top 25 C Programming Interview Questions for Freshers

1. Why is the C language called “the origin/mother of all other languages”?

The first question on the list of the Top 25 C Programming Interview Questions for Freshers is Why is the C language called the mother of all other languages? It is the oldest language that came into existence as it creates the base of the programming world, many of the modern programming languages are being evolved from C only. It has a wide number of applications as it is widely used to design compilers and kernels.

2. The why main( ) function is used in C?

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is why main( ) function is used in C. It is the main part from where the execution of our program starts, as the entry section of every program. It is very important to include the main( ) function in every c program, then only the program execution takes place. It is not like the common function which has to be executed for some purpose.

3. Explain the difference between variable and constant in C

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is between variable and constant in C programming. These both are used for constructing or designing a program in C. However, the common difference in both is we can alter or change the values of variables assigned at any time in our program as per requirements whereas we can’t do this with constants declared, the value of constants is the same as declared throughout the program.

4. What do you mean by Pre-processor?

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is What do you mean by Pre-processor? It is considered a separate step in the compilation process, i.e., our written code is first translated using a pre-processor, and then it is sent for compilation. It acts as the directive which gives the instructions to the compiler.

5. Explain the use of the header file in C

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is to Explain the use of the header file in C. The header file is the most important thing to include while writing our program in C, it contains a lot of pre-defined functions that are to be used in our program for example the printf( ) and scanf( ) functions can be used under the <stdio.h> header file.

6. What are reserved keywords in C?

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is reserved keywords in C. By the name only we can understand that these have a special meaning in C, and are reserved for something special and can be used for that only. There is a total of 32 reserved keywords available in C.

7. What is the difference between a variable that is declared as local or global?

This is the next question in this list of the Top 25 C Programming Interview Questions for Freshers. Global variables are the variables declared globally. i.e., outside the function and can be used anywhere inside the program at any time, whereas local variables are the variables declared inside a particular function and it comes into execution when that function starts and loses when the function terminates.

8. Why the “\0” character is used?

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is Why the “\0” character is used? It is called a NULL character, which is used for indicating the end of the strings.

9. Explain the difference between the “equal to =” and “double equal to ==” operator

The assignment operator is called the “=” equal to the operator which is used for assigning any value, whereas the equivalent operator is called the “==” double equal to the operator which is used for comparing whether the two values are equal or not.

10. What do you understand by nested loop?

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is understood by the nested loop. The loop inside another loop is called a nested loop, it is mainly used when working with multi-dimensional concepts.

11. What is the use of curly braces { } in the program?

It is mainly used to tell the scope of the particular function i.e., used for grouping the lines of code in one function. It is good practice to use curly braces as it makes our code looks good.

12. Explain Syntax error

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is Explain Syntax error. It is an error in the source code of our program. As we all know that C programming language is a case-sensitive language, so all the syntax should be written carefully. It may be any command that was misspelt or written in the wrong way.

13. What do you understand by the “void” keyword when used in any function?

While declaring any function we have to mention the return type of that function, and if that function is not returning any value i.e., it is simply used for displaying some output, then in that case void is used as the return type and if that function is returning any value, then we can’t use void as a return type.

14. Explain the term debugging

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is to Explain the term debugging. Debugging simply means o find errors, like upon compilation, the compiler stops compiling the code where the error has been encountered, so now it’s the programmer’s duty to find that error in the code, this can be achieved by debugging.

15. What are NULL pointers in C?

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is What are NULL pointers in C? If we don’t know the exact position to be assigned at the time of pointer declaration, then it is simply pointed to a NULL value, i.e., 0, and this pointer is then called a NULL pointer.

16. Explain the term Memory leak in C

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is to Explain the term Memory leak in C. When the memory is created in the Heap data structure and the programmer forgets to delete that memory after use, then it slows the efficiency of the program and creates the leakage of memory.

17. What do you mean by dangling pointers in C?

When the pointer is pointing to the memory location which is already deleted, then that pointer is called the dangling pointer in C or we can simply say that it points to the dereferenced memory location.

18. What do you mean by auto keyword in C?

The local variable is simply called the auto (variable) also, it is optional to use the auto keyword before the declaration of the local variable.

19. What is a token in C?

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is What is a token in C? A token is simply called an identifier. It is classified as the smallest unit of the program. It can be anything like constant, keyword, strings, etc.

20. What do you understand by infinite loop?

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is What do you understand by infinite loop? When the loop body is executed continuously without taking a break, then it is said to be an infinite loop, it can simply be achieved by for (; ;), while (1), etc.

21. Tell the different storage class specifiers available in C

The different storage class specifiers available are register, auto, extern, and static.

22. Explain the role of the structure types in C Programming

The structure is used to store values of different data types under one name and is easy to access. It is mainly used to maintain records.

23. Describe in brief the file opening mode “w+”

“w+” mode means that the file is opened for both reading and for writing purposes also if the file does not exist it will create the file and if the file exists, the content will be overridden.

24. For what purpose a double hash “##” operators used in C

This Operator is basically used to concatenate 2 tokens into one and is also called a preprocessor macro in C.

25. Explain the use of “#define” in C

The next question in this list of the Top 25 C Programming Interview Questions for Freshers is Explain the use of “#define” in C. It is a pre-processor directive that is mainly used to define a constant value in our program.

List of Top 60 C Programming Interview Questions for Pros

So, here is the 60 list of questions with answers that are mostly asked in C interviews for Pro.

Top 60 C Interview Questions and Answers for Pros

1. Difference between calloc() and malloc()

The first question on the list of Top 60 C Programming Interview Questions for Pro is the Difference Between calloc() and malloc().

calloc() malloc()
The calloc() function is used for allocating multiple blocks of memory dynamically. The malloc() function is used for allocating a single block of memory dynamically.
It sets the default value for each block to ‘0’. Default garbage values are assigned to each block, initially.
Syntax:
ptr =(typecast*) calloc(n,size)
Syntax:
ptr = (typecast*) malloc(size)

2. Difference between actual and formal parameters

The second question in this list of Top 60 C Programming Interview Questions for Pro is the Difference between actual and formal parameters. The actual parameters are the variables or values passed during the function call whereas the formal parameters are the variables passed during the function definition.

3. Can a C program be built or run without a main() function?

The third question in this list of Top 60 C Programming Interview Questions for Pro is Can a C program be built or run without a main() function? The execution of a program starts from the main() function so without the main() function, a program will be compiled but never run. Hence, it is mandatory to use the main() function in a program.

4. Why is C referred to as a mid-level programming language?

The 4th question in this list of Top 60 C Programming Interview Questions for Pro is Why is C referred to as a mid-level programming language? C is referred to as a mid-level programming language because it possesses characteristics of both low-level and high-level computer languages.

5. List some of the features that make up the ‘C’ programming language.

The 5th question in this list of Top 60 C Programming Interview Questions for Pro is a List some of the features that make up the ‘C’ programming language.

  • Mid-level programming language
  • Better memory management using pointers
  • Simple
  • Portable
  • Structured

6. What are the functions printf() and scanf() in a C program?

The 6th question in this list of Top 60 C Programming Interview Questions for Pro is What are the functions printf() and scanf() in a C program? Both printf() and scanf() are predefined functions in the stdio.h header file. The printf() is used to print any message to the output screen and scanf() is used to take inputs from the user.

7. Define call by reference versus call by value in C language.

The 7th question in this list of Top 60 C Programming Interview Questions for Pro is Define call by reference versus call by value in C language. In call-by-value, any change in the formal parameters does not reflect the change in the actual parameters. The copy of the variable is passed as actual arguments.

In call by reference, any change in the formal parameters reflects the change in the actual parameters. The address of a variable is passed as actual arguments.

8. Can I use the int data type to hold a value of 32768?

The 8th question in this list of Top 60 C Programming Interview Questions for Pro is Can I use the int data type to hold a value of 32768? No, I cannot use the int data type to store a value of 32768 because the range of the int data type is -32768 to 32767.

9. Define array in C

The 9th question in this list of Top 60 C Programming Interview Questions for Pro is the Define array in C. An array is a user-defined data type used to store a group of elements of the same type referenced under a single name.

10. Define pointers in C

The 10th question in this list of Top 60 C Programming Interview Questions for Pro is Define pointers in C. A pointer is a variable that is used to store or hold the address of another variable of the same type.

11. What is a static variable in C?

The 11th question in this list of Top 60 C Programming Interview Questions for Pro is What is a static variable in C? A static variable in C is a variable whose lifetime is throughout the program i.e., it is destroyed after the complete execution of the program. Its default is 0. They are initialized only once.

12. What exactly is typecasting in C?

The 12th question in this list of Top 60 C Programming Interview Questions for Pro is What exactly is typecasting in C? When changing one data type to another, this is called typecasting.

13. What do you understand about static memory allocation?

The 13th question in this list of Top 60 C Programming Interview Questions for Pro is what do you understand about static memory allocation?

  • In static memory allocation, allocation of memory is done at compile time.
  • The memory allocated cannot be resized & de-allocated at run time.
  • It is utilized in the array.
  • It is quicker than dynamic memory allocation.
  • The lifetime of a static variable is till the end or termination of program execution.

14. Name the functions that are used for dynamic memory allocation in the C language.

The 14th question in this list of Top 60 C Programming Interview Questions for Pro is to name the functions that are used for dynamic memory allocation in the C language.

  • malloc()
  • calloc()
  • free()
  • realloc()

15. Write a program that prints “Hello, World!” with no semicolon (;) is needed.

The 15th question in this list of Top 60 C Programming Interview Questions for Pro is to write a program that prints “Hello, World!” with no semicolon (;) needed.

#include<stdio.h>
int main() {
   if(printf("Hello, World!")){}
   return 0;
}
//Output
//Hello, World!

16. Write a program that swaps two variables without using a third variable to do so.

The 16th question in this list of Top 60 C Programming Interview Questions for Pro is Write a program that swaps two variables without using a third variable to do so.

#include<stdio.h>
int main()
{
  int a,b;
  scanf("%d %d",&a,&b);
  printf("Before swapping: a=%d &amp; b=%d.\n",a,b);
  a=a+b;
  b=a-b;
  a=a-b;
  printf("After swapping: a=%d &amp; b=%d.\n",a,b);
  return 0;
}
//Output
//Before swapping: a=21 &amp; b=34.
//Before swapping: a=34 &amp; b=21.

17. Define structure in C

The 17th question in this list of Top 60 C Programming Interview Questions for Pro is Define structure in C. A structure is a user-defined data type that is used for storing the elements of multiple data types in a single unit. In C, a structure is defined using the struct keyword.

18. Define union in C

The 18th question in this list of Top 60 C Programming Interview Questions for Pro is Define union in C. A union in C is a user-defined data type that allows various types of data to be stored in a single unit. The memory occupied by the union is the size of the largest member only which is shared by all other members of the union. In C, we define union using the union keyword.

19. Name the data types used in C programming languages

The 19th question in this list of Top 60 C Programming Interview Questions for Pro is to Name the data types used in C programming languages.

  • int
  • float
  • char
  • double
  • void

20. Mention the difference between pre-increment & post-increment operators

The 20th question in this list of Top 60 C Programming Interview Questions for Pro is Mention the difference between pre-increment & post-increment operators. In the pre-increment operator, a variable is first incremented by 1 and then gets stored or assigned in the same variable.
In the post-increment operator, a variable is first stored and then gets incremented by 1.

21. In the C programming language, what does pointer to pointer mean?

The 21st question in this list of Top 60 C Programming Interview Questions for Pro is what pointer to pointer means. A pointer to a pointer, as its name indicates, is a variable that holds or includes the address of another pointer variable in its memory.
For example,

#include<stdio.h>
int main() {
  int x=30;
  int *p=&x;
  int **ptr=&p;
  printf("x=%d\n",x);
  printf("*p=%d\n",*p);
  printf("**ptr=%d\n",**ptr);
  return 0;
}
//Output
//x=30
//*p=30
//**ptr=30

22. Define header file in C

The 22nd question in this list of Top 60 C Programming Interview Questions for Pro is the Define header file in C. A header file in C is a file having “.h” file extensions. It contains a set of predefined function declarations, keywords, and macros definitions. We use “#include” to include header files in our program so that we can use predefined functions and macros.

23. What happens if a header file is included twice in a C program?

The 23rd question in this list of Top 60 C Programming Interview Questions for Pro is What happens if a header file is included twice in a C program? If a header file is included twice in a C program, the second one is ignored.

24. Difference between the header file enclosed in angular brackets and double quotes “”.

The 24th question in this list of Top 60 C Programming Interview Questions for Pro is the difference between the header file enclosed in angular brackets and double quotes “”.
. When a header file is included with >, the compiler only looks for it in the built-in include path. When a header file is included with ” “, the compiler looks for it first in the current working directory, then in the built-in include path if it isn’t found.

25. What do you mean when you say while(0) and while(1)?

The 25th question in this list of Top 60 C Programming Interview Questions for Pro is What do you mean when you say while(0) and while(1)? while(0) is equivalent to while(false) so the loop will never be executed whereas while(1) is equivalent to while(true) so it will result in an infinite loop.

Top 60 C Interview Questions and Answers for Pros

26. What do you understand by command line arguments in C?

The 26th question in this list of Top 60 C Programming Interview Questions for Pro

is What do you understand by command line arguments in C? The parameters given to the main() method of a C program from the command line during execution are known as command-line arguments.

Syntax

int main(int argc, char *argv[]) {}

argc denotes the number of arguments and argv denotes a pointer array holding arguments passed.

27. In C, explain the differences between struct and union.

The 27th question in this list of Top 60 C Programming Interview Questions for Pro is the differences between struct and union.

Struct Union
Structures are defined with the struct keyword in C. A union in C is defined using the union keyword.
The memory space occupied by the structure is equal to the sum of all the members’ sizes i.e., each member of the structure gets a separate memory. The memory space occupied by the union is equal to the size of the largest member i.e., a single memory block is shared by all the members of the union.

28. Define the typedef keyword in C

The 28th question in this list of Top 60 C Programming Interview Questions for Pro is to define the typedef keyword in C. In the C programming language, typedef is a keyword that is used to define an alias or alternate name for an existing type.

Syntax

typedef data-type variable_name;

For example,

#include<stdio.h>
int main() {
  typedef int variable;
  variable x=3;
  printf("%d",x);
  return 0;
}

29. In C, write a program that adds two integers without using the addition operator (+).

The 29th question in this list of Top 60 C Programming Interview Questions for Pro is to write a program that adds two integers without using the addition operator (+).

#include<stdio.h>
int main() {
  int a=5,b=6;
  // Method-1
  printf("%d\n",a-(-b));
  // Method-2
  printf("%d",abs(-a-b));
    return 0;
}

30. Explain why a++ executes faster than a+1

The 30th question in this list of Top 60 C Programming Interview Questions for Pro is Explain why a++ executes faster than a+1. If you want to increase the value of a++, you only need one machine instruction, such as INR. If you want to increase it by a+1, you need more than one instruction.

31. How can you tell the difference between ‘=’ and ‘==’?

The 32nd question in this list of Top 60 C Programming Interview Questions for Pro is the difference between ‘=’ and ‘==’. ‘=’ is an assignment operator which is used to assign values to variables whereas ‘==’ is a comparison operator which is used to compare two values.

32. What do you understand by an enum in C?

The 32nd question in this list of Top 60 C Programming Interview Questions for Pro is What do you understand by an enum in C? An enum is a user-defined data type in C created using the enum keyword. It makes the program more readable and understandable by assigning names to integer constants.
For example,

#include<stdio.h>
enum days{
  True=1,False=0
};
int main() {
  printf("%d %d",True,False);
  return 0;
}

33. Is there a difference between the getch() and getche() functions in the C programming language?

The 33rd question in this list of Top 60 C Programming Interview Questions for Pro is Is there a difference between the getch() and getche() functions in the C programming language? Yes, both getch() and getche() are different functions in C. getch() takes an input character from the keyboard but doesn’t print it on the screen whereas also takes an input character from the keyboard but prints it on the screen.

34. Is it possible to make your header files?

The 34th question in this list of Top 60 C Programming Interview Questions for Pro is whether it is possible to make your header files. Yes, we can make our header files in C, and by using #include directive we can make them included in our program.

35. Define macros

The 35th question in this list of Top 60 C Programming Interview Questions for Pro is Define macros. Macros are code segments that are replaced by the macro value. It is defined by the #define directive.

36. In C, is it possible to take a variable number of arguments in a function?

The 36th question in this list of Top 60 C Programming Interview Questions for Pro is In C, is it possible to take a variable number of arguments in a function? Yes, a function variable number of arguments by using the ellipsis operator (…).

37. What is dynamic memory allocation in C?

The 37th question in this list of Top 60 C Programming Interview Questions for Pro is What is dynamic memory allocation in C? Dynamic memory allocation in C is defined as the allocation of memory at run time or during the execution of the program. Thus, memory size can be increased or decreased according to our requirements. We use calloc() and malloc() to allocate memory dynamically and free() to deallocate the allocated memory.

38. Define wild pointers in C

The 38th question in this list of Top 60 C Programming Interview Questions for Pro is Define wild pointers in C. A wild pointer is a pointer that is not initialized with any value.
For example, int *ptr;

39. What do you know about far pointers and near pointers?

The 39th question in this list of Top 60 C Programming Interview Questions for Pro is What do you know about far pointers and near pointers? A far pointer is a pointer that is used to store 32-bit addresses and can access 2^32 or 4096 MB of a data segment.

In a 16-bit computer, a near-pointer is used to store 16-bit addresses within the current segment. They can access 2^16 i.e., 64KB of a data segment.

40. How many types of phases are there in recursion?

The 40th question in this list of Top 60 C Programming Interview Questions for Pro is How many types of phases are there in recursion? There are 2 phases of recursion in C:

  1. Winding phase
  2. Unwinding phase

41. Is it possible to call main() function recursively?

The 41st question in this list of Top 60 C Programming Interview Questions for Pro is Is it possible to call main() function recursively? Yes, we may recursively call the main() function.

42. Is there a limit to how long an identifier may be in C?

The 42nd question in this list of Top 60 C Programming Interview Questions for Pro is Is there a limit to how long an identifier may be in C? Yes, the maximum length of the identifier can be up to 31 characters.

43. What is the purpose of the pointer in the C programming language?

The 43rd question in this list of Top 60 C Programming Interview Questions for Pro is What is the purpose of the pointer in the C programming language?

  • Dynamic memory allocation
  • Used in data structures such as linked lists, graphs, and trees.
  • Call by reference.
  • Array items can be accessed by using pointers.

44. What do you understand by the scope of a variable in a C program?

The 44th question in this list of Top 60 C Programming Interview Questions for Pro is What do you understand by the scope of a variable in a C program? The scope of a variable is defined as a section or region of the program where a variable can be easily accessed.

45. Mention some of the differences between C++ and C

The 45th question in this list of Top 60 C Programming Interview Questions for Pro is Mention some of the differences between C++ and C.

C++ C
It is both a procedural and object-oriented programming language. It is a structured or procedural programming language.
For dynamic memory allocation, we use new and delete operators. We use malloc(), calloc() & free() functions for dynamic memory allocation.
It supports object-oriented features such as classes, objects, polymorphism, encapsulation, and inheritance. It does not support object-oriented programming languages
It follows a bottom-up approach. It follows a top-down approach.
It was developed by Bjarne Stroustrup. It was developed by Dennis Ritchie.

46. What is a self-referential structure in C?

The 46th question in this list of Top 60 C Programming Interview Questions for Pro is What is a self-referential structure in C? A self-referential structure in C is a structure having one or more pointers as a member pointing or referring to the structure of the same type. It is used in creating data structures such as linked lists, trees, and graphs.

For example,

  struct Node{
  int data;
  struct Node *link;
};

47. What is a static function in C?

The 47th question in this list of Top 60 C Programming Interview Questions for Pro is What is a static function in C? A static function in C is a function defined using the static keyword in C. It is created when we want to restrict the use of a function within a file where it is declared.

Syntax

static return-type function_name(){
}

For example,

static void func()
{
  printf("Static function in C.");
}

48. How do variable declaration and definition differ from one other?

The 48th question in this list of Top 60 C Programming Interview Questions for Pro is How do variable declaration and definition differ from one other? When a variable is declared, it informs the compiler of its data type and size, but when you define a variable in your code, it allocates memory to the variable.

We can declare a variable many times in a variable in program however, a variable may only be defined once.

49. Write a program in C to print backslash (\) characters

The 49th question in this list of Top 60 C Programming Interview Questions for Pro is to write a program in C to print backslash (\) characters.

int main()
{
  printf("\\");
  return 0;
}

50. Why do we use the arrow operator (->) in C?

The 50th question in this list of Top 60 C Programming Interview Questions for Pro is Why do we use the arrow operator (->) in C? We use the arrow operator (->) when a structure or union pointer variable is used to access structure or union members.

51. When we cannot use & (address-of ) operator in C?

The 51st question in this list of Top 60 C Programming Interview Questions for Pro is When we cannot use & (address-of ) operator in C. We cannot use & (address-of) operator with constants and variables declared using the register storage class.

52. Is there any error in the following C program?

The 52nd question in this list of Top 60 C programming Interview Questions and Answers for Pro is there any error in the following C program?

int main()
{
  printf("Hello, ") , printf("World!");
  return 0;
}

No, there will be no error in the given program because the comma (,) operator is used for separating two or more expressions or variables. Hence, the output will be “Hello, World!”.

53. Name the linker’s output file

The 53rd question in this list of Top 60 C programming Interview Questions and Answers for Pro is to Name the linker’s output file. The linker generates an executable output file.

54. Is it possible to do nested comments in C?

The 54th question in this list of Top 60 C programming Interview Questions and Answers for Pro is whether it is possible to do nested comments in C. No, we cannot do this.

55. What are the various modes of file in C?

The 55th question in this list of Top 60 C programming Interview Questions and Answers for Pro is What are the various modes of file in C?

  • r – The file has been opened to allow for reading.
  • w – Opens a file so that it can be written into.
  • a – Open for appending content at the end of the file.
  • r+ – You can read and write to the file that’s been opened.
  • w+ – You can read and write to the file that’s been opened.
  • a+ – Opens a file for appending content to the end of the file.

56. What is the purpose of using the realloc() function in C?

The 56th question in this list of Top 60 C programming Interview Questions and Answers for Pro is What is the purpose of using the realloc() function in C. realloc() function is used for resizing the memory block that is allocated dynamically.
Syntax

realloc(ptr, size)

The first argument, ptr, is a pointer pointing to the memory block allocated using either malloc() or calloc() and the second argument is the new size of a memory block.

57. Name the functions used in C file handling

The 57th question in this list of Top 60 C programming Interview Questions and Answers for Pro is to Name the functions used in C file handling.

  • fopen()
  • fprintf()
  • fscanf()
  • fputc()
  • fseek()
  • fgetc()
  • fclose()
  • ftell()

58. Write a C program to print a string without double quotes

The 58th question in this list of Top 60 C programming Interview Questions and Answers for Pro is Write a C program to print a string without double quotes.

#include<stdio.h>
#define print_string(string) #string

int main()
{
  printf(print_string(UseMyNotes));
  return 0;
}
//Output
//UseMyNotes

59. When using C, how can a negative integer be stored?

The 59th question in this list of Top 60 C programming Interview Questions and Answers for Pro is When using C, how can a negative integer be stored?

  • The given number excluding the negative sign is converted into a binary equivalent.
  • Now, we calculate the 2’s complement of a number.

60. Write a program in C to print the Fibonacci series

The last question in this list of Top 60 C programming Interview Questions and Answers for Pro is Write a program in C to print the Fibonacci series.

#include &lt;stdio.h&gt;
int main()
{
   int i, first=0, second=1, third, n;
   scanf("%d", &amp;n);
   printf("Fibonacci Series\n");
   printf("%d %d", first, second);
   for(i=2;i&lt;n;i++){
     third=first+second;
     printf(" %d", third);
     first=second;
     second=third;
  }
return 0;
}
//Output
//8
//Fibonacci Series
//0 1 1 2 3 5 8 13

I hope this module was really very helpful to you all, it consists of all the important and frequently asked questions in Interviews, for many more amazing modules, stay connected, until then, Happy coding, wish you all the best!