Select chapter



functions (3.papers)
loops (1.papers)
arrays (2.papers)
structures (3.papers)
unions (1.papers)
pointers (7.papers)
null pointers (1.papers)
strings (2.papers)
misc c concepts (1.papers)
Data structures (5.papers)
linked lists (3.papers)
trees (1.papers)
basics (5.papers)
Hide

Sponsored Links


  

c interview questions and answers

1
Does C has pass by reference concept like C++?
  1. Strictly speaking C has only pass by value mechanism, where pass by ref talks about "passing the address as value".
  2. Yes, it has both pass by value and pass by Reference mechanism.
  3. Yes, it has both pass by value and pass by Ref mechanism. But c++ pass by ref is different compared to c's.
  4. none of the above
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
5
double pointers in c:

What is the output of below c program?

#include  <stdio.h>

int main(void)
{
    int i = 10;
    int *p = &i;
    int **pp = &p;
    printf("%p\n",&i);//a
    printf("%p\n",p);//b
    printf("%p\n",*pp);//c
    printf("%d\n",i);//d
    printf("%d\n",*p);//e
    printf("%d\n",**pp);//f
    
    return 0;
}
  1. a,b,c prints the address of i; d,e,f prints the vlaue of i that is 10.
  2. a,b prints the address of i; but c prints different address; d,e,f prints the vlaue of i that is 10.
  3. a,b prints the address of i; but c prints different address; d,e prints the vlaue of i that is 10 but f prints some garbage value or may crash.
  4. only a prints address of i; b and c prints same address which is null; d prints 10; e&f prints some garbage value or may crash.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :