Discussion :: Command Line Arguments - Find Output of Program (Q.No.9)
|Vishal Kumbhar said: (Feb 9, 2011)|
argv means "friay"
++arv means "r"
it prints "r".
|Sunitha said: (Sep 25, 2011)|
|argc converts first string datatype to integer hence the string myprog converted to integer and argc reads no of arguments that passed assigneed that values to argv hence pointer points to to string friday's first character and its get incremented and points to r.|
|Pradeep said: (Nov 10, 2011)|
|Can,any one explain wat is difference between argc and argv?and wat operation it performs in program?with example....|
|Raut said: (Jan 20, 2012)|
int main(int argc,char *argv)
here argc is total no argument you have passed through
command line argument and argv is an array of pointers which hold all pointers to the arguments which you have passed.
for ex my prog.c is a source file. after compilation you got myprog.exe file(lets say if you dont use other file name then you will get ./a.out file by default).
now we type myprog.exe apple orange
|Kompri said: (Aug 17, 2012)|
++argv=friday & ++argv=r
so the output is correct
|Ashutosh said: (Oct 12, 2013)|
|argv is the base address of friday. And on incrementing the base address by will point to r because arg is a character pointer.|
|Sanjoy said: (Jan 28, 2014)|
|argv means " myprog ".
argv indicates "Friday".
++argv means = "riday".
It just point to the next character of f .
Here %c is given so only one character "r".
Will print if there were %s then "riday".
It prints "r".
|Sunaina said: (Jan 29, 2014)|
|Whats the difference between *++argv and **+argv?|
|Dfds said: (Mar 10, 2014)|
|argv means Friday.
When we increment pointer by one it will point to r.
|Sudha said: (Mar 25, 2015)|
The array has a continue memory allocation also. The array index start with zero is going on.
So the Friday store in array memory just like that start with zero.
So f contain a a=f; a=r; a=i, a[_]=y; so the print "r";
Friends please justify the answer.
|A$Tro said: (Aug 19, 2015)|
|This program will print an output on both environment Linux/windows-and I think we can define an array size using either variable/macros/const.
As I've tried to define the max as shown:
int max =20;
C Const int max=20; ------------- and it works on both cases.
So may be the error depends on the standard ANSCI CS99 etc.
|Vaishali said: (Aug 5, 2016)|
|Is there any differences between **++argv and *++argv?|
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.