Discussion
Which of the following statements correctly declare a function that receives a pointer to pointer to a pointer to a float and returns a pointer to a pointer to a pointer to a pointer to a float?
Answer: D
Correct answer: float ****fun(float***);
Read the declaration outward from the name. The parameter is a pointer to a pointer to a pointer to a float, so it is written float ***. The return type is one level deeper again, so it is float ****.
Count the asterisks against the words: three for the parameter, four for the return. The other options mismatch one or both. Where such declarations become unreadable, a typedef for the intermediate types is the usual remedy.
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