Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)?
cmd> sample 1 2 3 / sample.c / #include<stdio.h> int main(int argc, char argv[]) { int j; j = argv[1] + argv[2] + argv[ ?->(Show Answer!)
1. What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)?
cmd> sample 1 2 3 / sample.c / #include<stdio.h> int main(int argc, char argv[]) { int j; j = argv[1] + argv[2] + argv[3]; printf("%d", j); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.00 pm
Here argv[1], argv[2] and argv[3] are string type. We have to convert the string to integer type before perform arithmetic operation. Example: j = atoi(argv[1]) + atoi(argv[2]) + atoi(argv[3]);