C Programming Question and Answers

45. What is the difference between typedef and macros?
 
  • Typedef is used to create a new name to an already existing data type. Redefine the name creates conflict with the previous declaration.
    Ex: typedef unsigned int UINT 32
  • Macros[#define] is a direct substitution of the text before compling the whole code. In the given example, its just a textual substitution. Where there is a possibility of redefining the macro
    Eg: #define chpointer char *
    Undef chpointer
    #define chpointer int *
 
Your Name Your Email-ID
Your Answer
46. What is the advantage of a random file?
  If the amount of data stored in a file is fairly large, the use of random access will allows you to search through it quicker. If it had been a sequential access file, you would have goto through one record at a time until you reach the target data. A random access file lets you jump directly to the target address where data is located.
 
Your Name Your Email-ID
Your Answer
47. What is the general form of a C program?
  A C program begins with the preprocessor directives, in which the programmer would specify which header file and what constants (if any) to be used. This is followed by the main function heading. Within the main function lies the variables declaration and program statements.
 
Your Name Your Email-ID
Your Answer
48. What is dynamic data structures?
  Dynamic data structure provides a means for storing data more efficiently into memory. Using dynamic memory allocation, your program will access memory spaces as needed. This is in contrast to static data structure, wherein the programmer has to indicate a fix number of memory space to be used in the program.
 
Your Name Your Email-ID
Your Answer
123456789101112


131415 Page 12 of 15