C Programming - Command Line Arguments - Discussion

Discussion Forum : Command Line Arguments - Find Output of Program (Q.No. 14)
14.
If the following program (myproc.c) is present in the directory "C:\TC" then what will be output of the program if run it from DOS shell?
/* myproc.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    printf("%s", argv[0]);
    return 0;
}
SAMPLE.C
C:\TC\MYPROC.EXE
C:\TC
Error
Answer: Option
Explanation:
In order to execute it from DOS shell, we have to run the created EXE file by entering the exe file name as C:\TC>myproc <enter>.
Discussion:
2 comments Page 1 of 1.

S.p said:   3 years ago
Here copy destination to source and print a new value after execute.

Ankush said:   1 decade ago
OK so you're saying that this string "C:\TC>myproc" will be copied into the argument and then it'll be on the CMD screen when actual program executes? Right?

Post your comments here:

Your comments will be displayed after verification.