C Programming - Command Line Arguments - Discussion

Discussion Forum : Command Line Arguments - Yes / No Questions (Q.No. 3)
Does there exist any way to make the command-line arguments available to other functions without passing them as arguments to the function?
Answer: Option
Using the predefined variables _argc, _argv. This is a compiler dependent feature. It works in TC/TC++ but not in gcc and visual studio.
10 comments Page 1 of 1.

Mounica said:   6 years ago
Explain it with the example.

Shivan said:   6 years ago
Anyone please explain it.

X0r said:   7 years ago
When a program starts, _start calls __libc_start_main which in turn calls main.Then in _start, rdx register points to argv and rsi register points to argc, and they are pushed into the stack. So just carefully craft a pointer and you can access them from main.

George said:   1 decade ago
For those trying to use _argc, _argv - note that it works only in TurboC!

Suganya said:   1 decade ago
Explain _argc and _argv?

Spiro said:   1 decade ago
You can assign argc and argv to your own global variables and not rely on existence of any default globals.

Rupinderjit said:   1 decade ago
These are global variable and available to all files and associated functions throughout the program.

Proiya said:   1 decade ago
Explain _argc and _argv ?

Preetha said:   1 decade ago
Can any one explain how _argc and _argv are used with an example?

Madhu said:   1 decade ago
Can any one explain how _argc and _argv are used with an example?

Post your comments here:

Your comments will be displayed after verification.