Interview Questions

Frequently Asked C Interview Questions by the Recruiters6 min read

January 6, 2020 4 min read
C interview questions


Frequently Asked C Interview Questions by the Recruiters6 min read

Read­ing Time: 4 min­utes

Before direct­ly going to the ques­tions, C Inter­view Ques­tions, first­ly, you need to have a faint idea of what C lan­guage is. Sec­ond­ly, you should know how to write the codes for a giv­en prob­lem. C lan­guage is basi­cal­ly used in the devel­op­ment of sys­tem appli­ca­tions that major­ly con­tributes to oper­at­ing sys­tems. The oper­at­ing sys­tem not nec­es­sar­i­ly has to be Win­dows, instead, it could be Unix and Lin­ux as well. The lan­guage in which UNIX appli­ca­tions along with Oper­at­ing sys­tems and C com­pil­er is being writ­ten is called C lan­guage.

With this, you can pro­ceed with the C Inter­view Ques­tions, but, start from the very basic. You nev­er know what type of ques­tions you will be asked by your exam­in­er. Make sure, you have good the­o­ret­i­cal knowl­edge along with prac­ti­cal imple­men­ta­tion.  The first ques­tion in the series of C Inter­view Ques­tions is as fol­lows.

Read these Python Inter­view Ques­tions blog that will qual­i­fy you for Python Inter­views with the most pos­si­ble ques­tions you are going to be asked in 2020.

Q1. Name the different storage class specifiers in C?

To answer this ques­tion, one should not take that much of time and prompt­ly should answer that the stor­age class spec­i­fiers in C are auto, reg­is­ter, sta­t­ic and extern.

Q2. What do you know about the NULL pointer?

You should start by telling that NULL POINTER does not point to any object or func­tion. A devel­op­er ini­tial­izes point­ers as a NULL POINTER only if they are not aware of their val­ue at the time of being declared. But, a point­er is actu­al­ly NULL at the time when mem­o­ry is being point­ed by its deal­lo­ca­tion amidst the pro­gram.

Q3. Could you explain Modular Programming?

Mod­u­lar Pro­gram­ming is noth­ing but a divi­sion of pro­grams into sub-pro­grams or sub-mod­ules or sub-func­tions. This sub­di­vi­sion helps in achiev­ing the giv­en task and is a mod­u­lar approach. Gener­ic func­tion def­i­n­i­tion gives the abil­i­ty to re-use the func­tions, like built-in library func­tions.

You could read more ques­tions like that so that you could pre­pare your­self for the C Inter­view Ques­tions that are the­o­ry-based. How­ev­er, prac­ti­cal knowl­edge and prac­ti­cal imple­men­ta­tion are equal­ly impor­tant. You should know how to place your codes accord­ing to the giv­en query because you are step­ping in the world of codes.

Q4. What is the process to create increment and decrement stamen in C?

You have two ways to solve this query. First is,

Use incre­ment (++) and decre­ment (-) oper­a­tor.

for instance,  When x=4, x++ returns 5 and x- returns 3.

the sec­ond method is to use con­ven­tion­al + or – sign.

When x=4, use x+1 to get 5 and x‑1 to get 3.

Q5. How is a Function declared in C Language?

A func­tion in C lan­guage is declared as:

return_type function_name(formal para­me­ter list)

Q6. Can a program be compiled without the main() function?

Yes, the com­pi­la­tion is pos­si­ble, but the exe­cu­tion is not pos­si­ble.

How­ev­er, if you use #define, we can exe­cute the pro­gram with­out the need for main().

For instance:

#include <stdio.h> 
#define start main    
void start() {    

Q7. Write a loop statement that will show the following output:






This is a lit­tle com­plex process but you could start one by one so that you could exe­cute the pro­gram eas­i­ly.

for (a=1; a&lt;=5; i++) {

for (b=1; b&lt;=a; b++)




Q8. Write a simple code fragment that will check if a number is positive or negative.

The code

If (num&gt;=0)

printf(&quot;number is pos­i­tive&quot;);


printf (&quot;num­ber is neg­a­tive&quot;);

Q9. Write down a sim­ple code frag­ment that will swap the val­ues of two vari­ables num1 and num2.

The code is as fol­lows:

int temp;

temp = num1;

num1 = num2;

num2 = temp;

Q10. Create pointer on a pointer in C programming language. 

Here is a code that dis­plays a point­er on a point­er in C pro­gram­ming lan­guage.

int main()


    int v1 = 54; 

    int *pointer2; // point­er for var

    int **pointer1; // dou­ble point­er for ptr2

    pointer2 = &v1; // stor­ing address of var in ptr2  

    pointer1 = &pointer2; // Stor­ing address of ptr2 in ptr1    

    printf(“Value of v1 = %d\n”, v1);

    printf(“Value of v1 using sin­gle point­er = %d\n”, *pointer2 );

    printf(“Value of v1 using dou­ble point­er = %d\n”, **pointer1);

  return 0;


Q11. How to display the ASCII value of the uppercase character ‘A’ using the concept of implicit type conversion?

The cod­ing for the same is as fol­lows.


int main()


char char­ac­ter = ‘A’;

int num­ber = 0, val­ue;

val­ue = char­ac­ter + num­ber;

printf(“The ASCII val­ue of A is: %d\n”,value);

return 0;

Q12. Access the address of a pointer to a variable.


int main()


int val­ue;

int *value_pointer;

int **pointer_to_pointer;

value_pointer = &value;

pointer_to_pointer = &value_pointer;

printf(“The val­ue of the vari­able is: %d\n”, val­ue);

printf(“The mem­o­ry address of the vari­able is: %p\n”, value_pointer);

printf(“The mem­o­ry address of the point­er to the vari­able is: %p\n”, pointer_to_pointer);

return 0;


Q13. Find the length of a string without using the inbuilt function strlen().

#include <stdio.h>

int main()


printf(“Welcome to DataFlair tutorials!\n\n”);

char String[50];

int count;

printf(“Enter a string: ”);

scanf(“%s”, String);

for(count = 0; String[count] != ‘\0’; count++);

printf(“The length of string: %d\n”, count);

return 0;


Q14. Write a code snippet that changes a floating point number to an integer with the help of casting.

float f = 1.0;

int i1 = (int) f;

int i2 = * (int *) &f;

printf(“%d\n, i1);

printf(“%d\n, i2);

These ques­tions and cod­ings are real­ly sig­nif­i­cant and can be asked at an inter­view. While you are prepar­ing for c inter­view ques­tions pro­grams, make sure you go through the above ques­tions so that you could get a hint of how to tack­le and deal with a query that is placed as a ques­tion in front of you.

No mat­ter how good are you on the the­o­ret­i­cal part, you can not just ignore the cod­ing struc­ture. Being a devel­op­er, you should have prop­er knowl­edge of syn­tax. As a result, the inter­view­er will judge you upon your prac­ti­cal skills along with the the­o­ret­i­cal knowl­edge. In addi­tion to that, you should revise your chap­ters dai­ly so that you could pre­pare your­self in a bet­ter way and be in prac­tice so that you could not face the anx­i­ety while answer­ing the inter­view­er.

There are more scopes for C lan­guage in the future, so, if one is inter­est­ed in learn­ing the lan­guage, he or she should go for it with­out any sec­ond thought. Mas­ter­ing this lan­guage would open more oppor­tu­ni­ties for you and revis­ing the c inter­view ques­tions would enhance your chances to get inside a com­pa­ny where you can use your knowl­edge of C lan­guage effi­cient­ly. In oth­er words, you should try to bring out the best in you in terms of plac­ing the cod­ings.

Relat­ed Post: Best MVC Inter­view Ques­tions for Sure Shot Selec­tion

Relat­ed Post: Sele­ni­um Inter­view Ques­tions that you Can’t-Miss to Pre­pare

Gunjan Rawat is a literature graduate who shows keen interest in Java, SQL and Marketing as well.
Leave a comment

Your email address will not be published. Required fields are marked *