wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

The following program (myprog) is run from the command line as my prog 123 what would be the output? main {int argc,
char argv(])
[int i, j =0
for (i =o; ii < argc; i ++)
j=j+atoi(argv [i]);
printf("%d",j);]
}

A
1 2 3
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
6
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
Error
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
"123"
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is B Error
The output will be error. Because given that in the loop i=0 but it does not given that where i will be goes. So, j did not mentioned clearly.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Counting Principle
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon