Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

C Programming :: Command Line Arguments

Home > C Programming > Command Line Arguments > General Questions

1. which is the correct way of declaring main() when it receives comrnand line arguments ?

Answer: main (int argc, char argv[])

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

2. If the following program (Helloprog) is run from the command line as HelloProg 1 2 3. what would be the output?

main (int argc, char*argv[])
{
int i;
i = argv[1] + argv [2] + argv [3];
printf("%d", i);
}

Answer: Error

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

3. The following 'C' program (dumpProg) is run from the command line as "dumpProg friday tuesday Sunday". what would be the output?

#include
void main (int argc, char*argv[])
{
printf("%c", **++argv);
}

Answer: f

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

4. The following program (HelloProg) is run from the command line as HelloProg 1 2 3. what would be the output ?

#include
void main (int argc, char*argv[])
{
int i,j=0;
for (i=0; i < argc; i++)
j = j + atoi (argv[i]);
printf ("%d",j);
}

Answer: "123"

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

5. Maximum combined length of the command line arguments including the spaces between adjacent arguments is

Answer: It may vary from one operating system to another

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

6. What is the output of the following 'C' program ?

#include
void main (int argc, char*argv[], char*env[])
{
int i;
for (i=1; i printf ("%s", env[i]);
}

Answer: List of all environment variables

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

7. If the following program i.e "myprog" is run from the command line as "a.out" . What would be the output?

#include
void main (int argc, char*argvl))
{
int i;
for (i = 1; i < argc; i++)
print[ ("%s", argv[i]);
}

Answer: None of these

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

8. The following 'C' program (dumpProg) is run from the command line as "dumpProg friday tuesday Sunday". what would be the output?

void main (int argc, char*argv[])
{
printf("%c", **++argv);
}

Answer: f

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

9. The following 'C' program (dumpProg) is run from the command line as "dumpProg friday tuesday Sunday". what would be the output?

void main (int argc, char*argv[])
{
printf("%c", *++argv[1]);
}

Answer: r

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

10. If the following program (myprog) is present in the directory
c:/bc/tuesthen what would be its output ?

main (int argc, char*argv[])
{
printf ("%s", argv[0]);
}

Answer: C:\BC\TUCS\MYPROG.exe

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!