H
hn.ft.pris
#######################################
........
void argParser(int, char**);
int main(int argc, char** argv){
argParser(argc, argv);
return 1;
}
void argParser(int argc, char** argv){
char (*p)[argc] = (char(*)[argc])argv;
for(int i=0; i< argc; i++){
cout << *p+i << endl;
}
########################################
I've compiled above prgramme using gcc 3.4.2, and it passes, but it
doesn't work as I expected.
I thought it should simply output the executable programme name and all
the command line argument, but under linux I get some unmeaningful
characters. Why doesn't it work, thanks for helping me!
........
void argParser(int, char**);
int main(int argc, char** argv){
argParser(argc, argv);
return 1;
}
void argParser(int argc, char** argv){
char (*p)[argc] = (char(*)[argc])argv;
for(int i=0; i< argc; i++){
cout << *p+i << endl;
}
########################################
I've compiled above prgramme using gcc 3.4.2, and it passes, but it
doesn't work as I expected.
I thought it should simply output the executable programme name and all
the command line argument, but under linux I get some unmeaningful
characters. Why doesn't it work, thanks for helping me!