C Programming Question and Answers

49. 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
50. 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
51. What is an Ivalue?
  An Ivalue is an expression to which a value can be assigned. The Ivalues expression is located on the leftside of an assignment statement, whereas an rvalue is located on the right side of an assignment statement. Each assignment statements must have an Ivalue and an rvalue. The Ivalue expression must reference a storage variable in memory. It cannot be a constant.
 
Your Name Your Email-ID
Your Answer
52. What is the difference between null pointer and uninitialized pointer in C?
  Null pointer is a pointer which is pointing to nothing. Null pointer points to empty location in memory. Value of null pointer is 0. We can make a pointer to point to null as below.
int * p = NULL;
char * p = NULL;
uninitialized pointers are called as wild pointers in C which points to arbitrary memory location. This wild pointer may lead a program to behave wrongly or to crash.
 
Your Name Your Email-ID
Your Answer
123456789101112


131415 Page 13 of 15