Discussion
Even if integer/float arguments are supplied at command prompt they are treated as strings.
Answer: A
Correct answer: True
The shell passes arguments as text, and argv is an array of char *, so a program invoked as prog 42 receives the two-character string "42" and not the number 42.
Converting is the program's own job, with atoi, strtol or sscanf. Forgetting it produces the error the companion question shows, where adding two char * values is rejected outright - and, more insidiously, arithmetic on the character codes where the compiler happens to allow 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