Discussion
For the following expression to work, which option should be selected.
string p = “HELLO”;
Answer: B
Correct answer: typedef char * string;
The alias must be a pointer type, because a string literal in an expression yields the address of its first character. With typedef char *string; in place, string p = "HELLO"; simply stores that address. An array alias will not serve: an array type cannot be assigned to, and an unsized one is incomplete.
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