Find the output of the following program (sample.c

Loading

Choose the correct option.

Find the output of the following program (sample.c) in GCC compiler by giving command line arguments as :-

$gcc sample.c
$ ./a.out 1 2 3

/* sample.c */ 
#include
int main(int argc, char *argv[]) {
int j;
j = argv[1] + argv[2] + argv[3];
printf("%d", j);
return 0;
}

A. 6
B. Sample 6
C. Garbage Value
D. Compiler Error

Leave a Comment