C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - Point Out Errors (Q.No. 4)
4.
Which of the following is correct about err used in the declaration given below?
typedef enum error { warning, test, exception } err;
Answer: Option
Explanation:
A typedef gives a new name to an existing data type.
So err is a new name for enum error.
Discussion:
12 comments Page 2 of 2.
Nikhil said:
7 years ago
typedef is used to give a name for the already named variable for example.
typedef int BoyAge; // if every time in the code, I can't type BoyAge is a lengthy process so I can give a nickname to that variable.
BoyAge b;
I hope everyone understand this.
typedef int BoyAge; // if every time in the code, I can't type BoyAge is a lengthy process so I can give a nickname to that variable.
BoyAge b;
I hope everyone understand this.
(1)
Deepa said:
7 years ago
Please give an example.
(1)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers