Discussion
Output?
int main()
{
char a[2][3][3] = {'g','e','e','k','s','q','u','i','z'};
printf("%s ", **a);
return 0;
}
Answer: C
Correct answer: geeksquiz
The array is 2×3×3 = 18 bytes in one contiguous block. The nine initialisers fill the first nine, and the remaining bytes are zero-filled, as a partly initialised array always is. **a is the address of the first byte, and %s prints from there to the first null - which is byte 10. So the whole run of nine characters comes out, with no garbage after 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