21. What are the pointer declarations used in C?
Ans:
1- Array of pointers, e.g , int *a[10]; Array of pointers to integer
2-Pointers to an array,e.g , int (*a)[10]; Pointer to an array of into
3-Function returning a pointer,e.g, float *f( ) ; Function returning a pointer to float
4-Pointer to a pointer ,e.g, int **x; Pointer to apointer to int
5-pointer to a data type ,e.g, char *p; pointer to char
Ans:
1- Array of pointers, e.g , int *a[10]; Array of pointers to integer
2-Pointers to an array,e.g , int (*a)[10]; Pointer to an array of into
3-Function returning a pointer,e.g, float *f( ) ; Function returning a pointer to float
4-Pointer to a pointer ,e.g, int **x; Pointer to apointer to int
5-pointer to a data type ,e.g, char *p; pointer to char
Advertisement
22. What is the invalid pointer arithmetic?
Ans:
i) adding ,multiplying and dividing two pointers.
ii) Shifting or masking pointer.
iii) Addition of float or double to pointer.
iv) Assignment of a pointer of one type to a pointer of another type ?
23. Can main () be called recursively?
Ans: Yes any function including main () can be called recursively.
Ans:
i) adding ,multiplying and dividing two pointers.
ii) Shifting or masking pointer.
iii) Addition of float or double to pointer.
iv) Assignment of a pointer of one type to a pointer of another type ?
23. Can main () be called recursively?
Ans: Yes any function including main () can be called recursively.
Advertisement
24. Can we initialize unions?( IMP)
Ans: ANSI Standard C allows an initializer for the first member of a union. There is no standard way
of initializing any other member (nor, under a pre-ANSI compiler, is there generally any way of
initializing a union at all).
25. what is the similarity between a Structure, Union and enumeration?( IMP)
Ans: All of them let the programmer to define new data type.
26. What is a union?
Ans: Union is a collection of heterogeneous data type but it uses efficient memory utilization technique by allocating enough memory to hold the largest member. Here a single area of memory contains values of different types at different time. A union can never be initialized.
27. What are the differences between structures and arrays?
Ans: Structure is a collection of heterogeneous data type but array is a collection of homogeneous data types.
Array
1-It is a collection of data items of same data type.
2-It has declaration only
3-.There is no keyword.
4- array name represent the address of the starting element.
Structure
1-It is a collection of data items of different data type.
2- It has declaration and definition
3- keyword struct is used
4-Structure name is known as tag it is the short hand notation of the declaration.
28. What is an argument?
Ans: An argument is an entity used to pass data from the calling to a called function.
29. What are bit fields? What is the use of bit fields in a Structure declaration?
Ans: A bit field is a set of adjacent bits within a single implementation based storage unit that we
will call a “word”.
The syntax of field definition and access is based on structure.
Struct {
unsigned int k :1;
unsigned int l :1;
unsigned int m :1;
}flags;
the number following the colon represents the field width in bits.Flag is a variable that contains three bit fields.
30. What is FILE?
Ans: FILE is a predefined data type. It is defined in stdio.h file.
Ans: ANSI Standard C allows an initializer for the first member of a union. There is no standard way
of initializing any other member (nor, under a pre-ANSI compiler, is there generally any way of
initializing a union at all).
25. what is the similarity between a Structure, Union and enumeration?( IMP)
Ans: All of them let the programmer to define new data type.
26. What is a union?
Ans: Union is a collection of heterogeneous data type but it uses efficient memory utilization technique by allocating enough memory to hold the largest member. Here a single area of memory contains values of different types at different time. A union can never be initialized.
27. What are the differences between structures and arrays?
Ans: Structure is a collection of heterogeneous data type but array is a collection of homogeneous data types.
Array
1-It is a collection of data items of same data type.
2-It has declaration only
3-.There is no keyword.
4- array name represent the address of the starting element.
Structure
1-It is a collection of data items of different data type.
2- It has declaration and definition
3- keyword struct is used
4-Structure name is known as tag it is the short hand notation of the declaration.
28. What is an argument?
Ans: An argument is an entity used to pass data from the calling to a called function.
29. What are bit fields? What is the use of bit fields in a Structure declaration?
Ans: A bit field is a set of adjacent bits within a single implementation based storage unit that we
will call a “word”.
The syntax of field definition and access is based on structure.
Struct {
unsigned int k :1;
unsigned int l :1;
unsigned int m :1;
}flags;
the number following the colon represents the field width in bits.Flag is a variable that contains three bit fields.
30. What is FILE?
Ans: FILE is a predefined data type. It is defined in stdio.h file.