Discussion
Consider the following type definition.
typedef char x[10];
x myArray[5];
What will sizeof(myArray) be ? (Assume one character occupies 1 byte)
Answer: C
Correct answer: 50 bytes
The typedef makes x mean char[10]. So x myArray[5] is an array of 5 such arrays:
A typedef of an array type is easy to misread, because the array-ness is hidden behind the name; expanding it back out is the reliable way to size it.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development