Discussion
What is the notation for the following functions?
1. int f(int a, float b)
{
/* Some code */
}
2. int f(a, b)
int a; float b;
{
/* Some code */
}
Answer: C
Correct answer: 1. ANSI Notation 2. KR Notation
The first form declares each parameter’s type inside the parentheses - the ANSI (prototype) style, introduced by the 1989 standard. The second lists only the names in the parentheses and declares their types between the parentheses and the body - the old Kernighan and Ritchie style. The ANSI form matters because it lets the compiler check the arguments at every call; the K&R form does not, and is now obsolete.
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