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