command line arguments are sroted in uninitialized part of OS by default
they are 0 or NULL and they are created dynamicallly dats y this all is
happening..
sorry for being so late i didnt see it
--
You received this message because you are subscribed to the Google Groups
Algorithm
Bcoz u r trying to access an argument which doesnt even exist...
for exmple ./a.out -- argc=1
(argv[0]=./a.out,argv[1]=NULL(not exist))
./a.out 1st_arg -- argc=2
(argv[0]=./a.out,argv[1]=1st_arg,argv[2]=NULL(not exist));
resulting '0' as %d specifier is used the print
will it not give an erroneous result since, argc = number of elements in
argv starting from 0?
On Sun, Oct 7, 2012 at 6:33 PM, rahul sharma rahul23111...@gmail.comwrote:
#includestdio.h
int main(int argc,char *argv[])
{
printf(%d\n,argv[argc]);
getchar();
return 0;
}
If its NULL then y does it give segmentation fault as for NULL it should
print an empty stringplz xomment
On Sun, Oct 7, 2012 at 6:56 PM, DHARMENDRA KUMAR VERMA
dharmendrakumarverm...@gmail.com wrote:
Bcoz u r trying to access an argument which doesnt even exist...
for exmple
@dharmendradoes every uninitialized memory has NULL or there can be
some garbage value also...plz comment???
On Mon, Oct 8, 2012 at 9:02 PM, rahul sharma rahul23111...@gmail.comwrote:
If its NULL then y does it give segmentation fault as for NULL it should
print an empty stringplz
#includestdio.h
int main(int argc,char *argv[])
{
printf(%d\n,argv[argc]);
getchar();
return 0;
}
what will it print n y??
thnx
rahul
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to