/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%d %s", argc, argv[1]); return 0; }
Discuss About this Question.
/* 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; }
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]);
/* myprog.c */ #include<stdio.h> #include<stdlib.h> int main(int argc, char **argv) { printf("%s\n", *++argv); return 0; }
/* myprog.c */ #include<stdio.h> int main(int argc, char **argv) { printf("%c\n", **++argv); return 0; }
To install on iPhone/iPad: tap Share → Add to Home Screen.
Discuss About this Question.