Interview Questions on Functions in C


c interview questions
A set of questions on functions in C, covered in Interview Mantra.

  1. What is the purpose of main() function?
  2. Explain command line arguments of main function?
  3. What are header files? Are functions declared or defined in header files ?
  4. What are the differences
    between formal arguments and actual arguments of a function?
  5. What is pass by value in functions?
  6. What is pass by reference in functions?
  7. What is a recursive function?
  8. What are the differences between getchar() and scanf() functions for reading strings?
  9. Out of the functions fgets() and gets(), which one is safer to use and why?
  10. What is the difference between the functions strdup() and strcpy()?
  11. Write a program to compare two strings without using strcmp() function.
  12. Write a function to concatenate two strings without using strcat() function.
  13. What are the differences between malloc() and calloc()?
  14. How to use the function realloc()?
  15. Declare an array of three function pointers where each function receives two integers and returns float.
  16. Explain the variable assignment in the declaration
    int *(*p[10])(char *, char *);
  17. Write a program in C that returns 3 numbers from a function.
  18. In below code snippet:
    struct Date{
     int yr;
     int day;
     int month;
    } date1,date2;
    date1.yr = 2004;
    date1.day = 4;
    date1.month = 12;
    

    Write a function in C that assign values to date2. Arguments to the function must be pointers to the structure Date and integer variables date, month, year.


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



All comments of post - "Interview Questions on Functions in C":

:Haha! I'am the first! Yeh~

Thank you!

Add a Comment / Trackback url

Comment begin from here or jump up!