Exercise: Typedef

Questions for: Typedef

What will be the output of the program?
#include<stdio.h>

int main()
{
    enum color{red, green, blue};
    typedef enum color mycolor;
    mycolor m = red;
    printf("%d", m);
    return 0;
}
A:
1
B:
0
C:
2
D:
red
Answer: B
No answer description is available. Let's discuss.
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
Answer: C
No answer description is available. Let's discuss.
In the following code what is 'P'?
typedef char *charp;
const charp P;
A:
P is a constant
B:
P is a character constant
C:
P is character type
D:
None of above
Answer: A
No answer description is available. Let's discuss.
In the following code, the P2 is Integer Pointer or Integer?
typedef int *ptr;
ptr p1, p2;
A:
Integer
B:
Integer pointer
C:
Error in declaration
D:
None of above
Answer: B
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz