answersLogoWhite

0


Best Answer
Answer

yes they are local to main


Answerargc and argv can be used as variable names anywhere in a C program. If they are declared as arguments to main() then they are local to main:

int main(int argc, char *argv[])
{
// argc and argv are local to main in this short program
return 0;
}
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Are the variables argc and argv are local to main?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is an example of a parameter?

'argc' and 'argv' in this line: int main (int argc, char **argv)


Wap of function call by value?

This 'question' is not a question, but here you are. int main (int argc, char **argv) { printf ("argc=%d argv=%p\n", argc, argv); return 0; }


What is earlier declaration for main?

pick one: int main (void); int main (int argc, char **argv); int main (int argc, char **argv, char **envp);


What does char argv mean?

The full form of this is: char* argv[]; Where argv is a pointer to a null-terminated array of null-terminated strings. We use this type of argument to pass command line switches to the main function: int main (char * argv[], int argc); The names of these arguments, argv and argc, are conventional. The argc argument tells us how many elements are in the argv argument, such that argv[0] is the full-qualified name of the executable and argv[argc] is the null-terminator of the array. Any and all other elements (argv[n], such that 0<n<argc) represent programmer-defined command-line switches.


What is the Syntax of recursion in turbo c?

Nothing. A function may call itself just like any other function, eg: int main (int argc, char **argv) { if (argc>0) { puts (argv[0]); main (argc-1, argv+1); } return 0; }


What is an example of array?

argv, which is the second parameter of function mainint main (int argc, char *argv[])


What does charred mean?

The full form of this is: char* argv[]; Where argv is a pointer to a null-terminated array of null-terminated strings. We use this type of argument to pass command line switches to the main function: int main (char * argv[], int argc); The names of these arguments, argv and argc, are conventional. The argc argument tells us how many elements are in the argv argument, such that argv[0] is the full-qualified name of the executable and argv[argc] is the null-terminator of the array. Any and all other elements (argv[n], such that 0<n<argc) represent programmer-defined command-line switches.


Types of main function in C programming?

minimalist: int main (void); standard: int main (int argc, char **argv); unix-only: int main (int argc, char **argv, char **envp);


Can you give an example of array program?

int main (int argc, char *argv[]) { int i; for (i=0; i<argc; ++i) printf ("%2d: %s\n", i, argv[i]); return 0; }


What is a valid heading for the main program?

For a 'C' program, the main routine must be on of these:int main (void)int main (int argc, char ** argv)int main (int argc, char ** argv, char **envp) /* on some platforms */


What is the purpose of the parenthese following the world main in a c program?

The parentheses following the word main in a C or C++ program introduces the argument list for the call to main. The standard prototype is... int main (int argc, char *argv[]); ...where argc is the number of words on the command line, and argv is an array of pointers to arrays of null terminated arrays of characters, one for each white space delimited word on the command line. If you said `myprog this is a test` you would get argc = 5 argv[0] = "myprog" argv[1] = "this" argv[2] = "is" argv[3] = "a" argv[4] = "test"


Sample do while loop in turbo c?

int main (int argc, char **argv) { int i=0; do printf ("%2d. %s\n", i, argv[i]); while (++i<argc); return 0; }