DevScript Saga

Welcome to DevScript Saga!

A little Helping Hand for Devs

Question 1 :Which of these executes Faster i++ or i+1?

Answer :

i++ is faster. The expression i++ requires a single machine instruction such as INR to carry out the increment operation whereas i+1 requires more instructions to carry out this operation.

Question 2 : What Are The Advantages Of Auto Variables?

Answer :

  1. The same auto variable name can be used in different blocks.
  2. There is no side effect by changing the values in the blocks.
  3. The memory is economically used.
  4. Auto variables have inherent protection because of local scope.

 Question 3: What Is A Null Pointer?

Answer :

There are times when it’s necessary to have a pointer that doesn’t point to anything. The macro NULL, defined in , has a value that’s guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*.  The null pointer is used in three ways:

  1. To stop indirection in a recursive data structure
  2. As an error value
  3. As a sentinel value

Question 4 : Why Should I Prototype A Function?

Answer :

A function prototype tells the compiler what kind of arguments a function is looking to receive and what kind of return value a function is going to give back. 

One response to “Important Interview questions for C (Part 1):”

Leave a reply to richatamhane05 Cancel reply