C- Typedef Questions and Answers
Practice ModeShowing 10 of 23 questions
Q1
In the following code, the P2 is Integer Pointer or Integer?
typedef int *ptr;
ptr p1, p2;
Answer: Option B
Q2
In the following code what is 'P'?
typedef char *charp;
const charp P;
Answer: Option A
Q3
What is x in the following program?
#include<stdio.h>
int main()
{
typedef char (*(*arrfptr[3])())[10];
arrfptr x;
return 0;
}
Answer: Option C
Q4
What is the primary purpose of typedef in C?
Answer: Option B
Explanation: typedef creates alias names for existing types
Q5
Which of the following is the correct syntax for typedef?
Answer: Option C
Explanation: typedef is followed by existing type and then new name
Q6
What does typedef do with structures?
Answer: Option B
Explanation: typedef can create shorter names for structures
Q7
Which statement about typedef is FALSE?
Answer: Option D
Explanation: typedef doesn't create new types, just aliases
Q8
How to declare a typedef for an integer pointer?
Answer: Option B
Explanation: Use typedef with int* and new name
Q9
What is the advantage of using typedef with function pointers?
Answer: Option C
Explanation: Function pointers become more readable with typedef
Q10
Can typedef be used with arrays?
Answer: Option C
Explanation: Yes, typedef can create array type aliases