Interview Questions on Pointers in C

by Sridhar Jammalamadaka on September 5, 2009


c interview questions

  1. What is a pointer in C?
  2. What are the advantages of using pointers?
  3. How is pass by reference achieved using pointers in C?
  4. What are the differences between malloc() and calloc()?
  5. How to use realloc() to dynamically increase size of an already allocated array?
  6. What is the equivalent pointer expression for referring an element a[i][j][k][l], in a four dimensional array?
  7. Declare an array of three function pointers where each function receives two integers and returns float.
  8. Explain the variable assignment in the declaration

    int *(*p[10])(char *, char *);
    
  9. What is the value of

    sizeof(a) /sizeof(char *)

    in a code snippet:

    char *a[4]={"sridhar","raghava","shashi","srikanth"};
  10. (i)What are the differences between the C statements below:

    char *str = "Hello";
    char arr[] = "Hello";
    

    (ii)Whether following statements get complied or not? Explain each statement.

    arr++;
    *(arr + 1) = 's';
    printf("%s",arr);
    


About the Author:  Sridhar Jammalamadaka is the Editor of Interview Mantra. He's a typically non-typical Software Engineer from Pune, India. He likes entrepreneurship, web technologies and Micro Controller programming. He enjoys playing cricket and piano (but rarely does these activities). Through this website, he wishes to gather a large community of aspiring engineers, entrepreneurs and professionals from all parts of the globe. You can connect with him on Facebook - http://www.facebook.com/sridhar.j


2,250 readers have already subscribed to email updates!

Enter your email address:

  • kanth

    very good

  • manjunath

    Too good ….very much use full ….good work!!!!!!!!!!!!!

Previous post:

Next post: