answersLogoWhite

0


Best Answer

The only way this can be achieved is by storing the command line arguments in global variables. However, this is not recommended. Global variables should only be used to represent truly global concepts, but command line arguments are local to the main function. The main function's primary role is to parse the command line arguments and invoke the appropriate functions, passing any required arguments (by value) to those functions that specifically require them. The main function's secondary role is to handle any exceptions not handled by the functions that it invokes.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Does there exist any way to make the command line argument available to other function without passing them as arrguments to function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

In dos what is the function of a parameter?

A parameter is a command-line switch or an argument to a function. We use parameters to specify the input variables for the commands or functions we invoke. For instance, when we want to list the contents of a directory or folder, we have to pass the directory or folder path to the appropriate command so that it knows which directory or folder to process.


How do you get the number of argument from command line?

It is very difficult task.but I will manage it by deep thinking on on the issue.


What is a command argument?

Command line arguments are provided at the time of running the program. Example: Suppose that your program needs input name and its value then running it from commandline(DOS prompt) you provide the values after the program name java xyz name JAX(name is name and value is jax)


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 work of argc and argv in c program?

The argc and argv identifiers in a (standardly declared) main function allow access to the command line arguments. The standard declaration is... int main (int argc, char *argv[]) ...or... int main (int argc, char **argv) The number of arguments is stored in argc. Since the name of the program is, by convention, always implicitly the first argument, then argc is always at least 1, even if there are no arguments. Each argument, then, is stored in argc[i], where i ranges from 0 to argc-1. The name of the program is stored at argv[0], and further arguments are argv[1], argv[2], etc. Normal convention is that each white space separated word on the command line is an argument. The exception is in the case of a quoted argument, in which case the entire quoted string, minus the quotes, is a single argument. Is is an error to attempt to write to any argument. If parsing by side effect parsers, such as with strtok(), is to be done, a copy of the argument must be made.

Related questions

What is the length command line argument in character?

Use the function strlen(string);


When the function argument box appears in excel?

When you choose the Insert Function command and then pick a function to use, it will appear so that you can type arguments into it.


What reflects an accurate argument in favor of a command economy?

Which statement reflects an accurate argument in favor of a command economy


What is the getopt function in PHP?

It gets options from the command line argument list. It can be used in PHP 4.3 and above, including PHP 5.


Command line argument?

Command line argument is a value that is passed to a program whenever the program is executed. It is used to avoid hard coding.


In dos what is the function of a parameter?

A parameter is a command-line switch or an argument to a function. We use parameters to specify the input variables for the commands or functions we invoke. For instance, when we want to list the contents of a directory or folder, we have to pass the directory or folder path to the appropriate command so that it knows which directory or folder to process.


What argument is most accepted by command economies?

Fair


What command would you issue from a command prompt to see a listing of the computers in your workgroup?

"net view" is the command and argument, with "net" being the command and "view" being the argument to view computers within your network, domain, or workgroup. As always, type it without the quotations.


What is man command?

The man command of the Linux operating system is the system's documentation pager. Each page argument given to man is normally the name of a program, utility or function. For example, to see the reference manual of the grep program: man grep


How do you write a Linux function that will go to any directory then ls and pwd on it?

WHAT I NEED DONE in .bash_profile define a function go_show, that willGo to a specific directoryPrint your current locationPrint the contents of your current directoryThe directory this function takes you to will be specified as an argument to the function on the command line. You will need to use a positional parameter to do this


What specifies the parameters that tailor a command to your particular needs?

argument


What to do when you have a bad argument?

I want to answer the question of linux command , what is the meaning of the tip " bad argument "peg" " in linux system ?