A. | P is a constant | B. | P is a character constant |
C. | P is character type | D. | None of above |
ANS - non now p is a contant pointer . note --typedef const char *charp; this is not a valid declaration since typedef doesn't declare an instance of a variable, it declares a type (type alias actually),
const is a qualifier you apply to an instance, not a type, so you can use static when you use the type.
3. |
What is x in the following program?
#include<stdio.h>
int main()
{
typedef char (*(*arrfptr[3])())[10];
arrfptr x;
return 0;
}
|
A. | x is a pointer |
B. | x is an array of three pointer |
C. | x is an array of three function pointers |
D. | Error in x declaration |
ans- c
explanation The return value of the function whose function pointer can be any of arrfptr[n]will be a pointer to an array of 10 characters.
The declaration can interpreted as "type of the array to be returned by function(char) (Returning char pointer(*)(function pointer name(*arrfptr)[size of the array of function pointers](3)(parameters)(void))[size of the array which will be returned from the function].
#include<stdio.h>
int main()
{
enum color{red, green, blue};
typedef enum color mycolor;
mycolor m = red;
printf("%d", m);
return 0;
}
|
|
No comments:
Post a Comment