C interview questions

What you will learn here, C interview questions:

  • C interview questions

1)Why c is platform dependent?

Please visit the following link to know why c is platform dependent in detail.

Why c is platform dependent

2)Can we use reserved keywords as identifier i.e variable name or function name?

No, You can’t use the reserved keyword as an identifier.

3)Can we use a variable before the declaration?

No, You can’t use a variable before the declaration. You have to declare variables before you use them.

4)What are the storage classes in c?

C has 4 storage classes and those are

  1. Automatic storage class
  2. Register storage class
  3. Static storage class
  4. External storage class

5)What is default storage class in c?

In C, Automatic storage class is the default storage class that is the reason we get garbage value as the default value for all non initialize variables.

6)Can we call main function in main function?

Yes, We can call main function in the main function.

7)Can we call main function from another function in c?

Yes, We can call main function form another function in C

8)Can we declare two variables with the same name?

No, you can not define two variables with the same name in the same scope but you can define two variables with the same name in different scope.

9)What is the difference between i++ and++i in c?

i++ is the post increment means it assigns the value and then increments the value of i by 1 where ++i is the pre increment means it increments the value of i by 1 and then assigns the value.

Example:
int i=0;
i++;   // here i is 0
++i;  // here i is 2

10) What is difference between parameter and argument?

Variables that we declare inside the parenthesis of the function definition is called a parameter where the argument is the actual values which we pass at the time of function call.

Example:
void test( int a, int b){}  // where a and b are parameters
test(10,20);   // where 10 and 20 are the arguments;

11)What is call by value and call by reference in c?

When we pass the direct value to the function is called as call by value and when we pass an address to the function is called a call by reference.

12)What is the difference between break and continue

A break statement takes the execution control out of the loop where A continue statement skips the execution of the statements after it and takes the control to the beginning of the loop.

13)What is the difference between = and == in c?

= is the assignment operator where == is equal to operator which is used to compare two variables.

14)What is binary operator in c?

logical AND (&&) and logical OR (||) are the binary operators in C because logical AND (&&) and logical OR (||) operates on two operands or data.

Example:

5>2 && 3>1  // where (5>2) is one operand and (3>1) is another operand

5>10 || 3>1  // where (5>10) is one operand and (3>1) is another operand

15)what is unary operator in c

Not(!) is the unary operator in C because it operates on a single operand or data.

Example:

(!5) // requires only one data

16)What is the difference between ‘\0’ and ‘0’?

The ASCII value ‘\0’ is the 0 where ASCII value for ‘0’ is 48. ‘\’0 acts as the end of string which is nothing but the null.

You may also like...

Leave a Reply