C Programming Question and Answers

53. Describe how arrays can be passed to a user defined function?
  One thing to note is that you cannot pass the entire array to a function. Instead, you pass to it a pointer that will point to the array first element in memory. To do this you indicate the name of the array without the brackets.
 
Your Name Your Email-ID
Your Answer
54. When should we use pointers in a C program?
 
  • To get address of a variable
  • For achieving the pass by reference in C
  • Pointers allow different functions to share and modify their local variables
  • To pass large structures so that complete copy of the structures can be avoided in C.
  • To implement "linked" data structures like linked lists and binary trees.
 
Your Name Your Email-ID
Your Answer
55. How do check whether macro is defined or not in C program?
  "#ifdef" pre-processor directive checks whether particular macro is defined or not in a C program.
 
Your Name Your Email-ID
Your Answer
56. What happens when the user gives a command to run a program?
  The operating system first allocates the requisite amount of memory to the program, then, through loader, loads the program in the allocated memory, and then passes on the control to the program. The program runs the supervision of the operating system. When the program finishes its execution or some runtime errors occurs, the operating system removes the program from the memory.
 
Your Name Your Email-ID
Your Answer
123456789101112


131415 Page 14 of 15