GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
In an alternative dimension there are lots of ways to turn other than left or right. Anyway, how do you know
whether Belgium is an alternative dimension?
argc is an array of pointers to strings, not a pointer to a string.
Also, it's:
Code:
int main(int argc, char* argv[])
not:
Code:
int main(char* argc[],int argv)
Also, argc is the count of arguments, argv is an array of pointers. argv[0] is the text you used to launch the program.
Code:
$ cat stuff.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
int i;
for(i=0; i<argc; i++) {
puts(argv[i]);
}
}
$ gcc stuff.c -o stuff
$ ./stuff
./stuff
$ ./stuff One
./stuff
One
$ ./stuff One Two
./stuff
One
Two
Thanks...I looked at another site trying to fix a different problem (completely unrelated to this one), and I found that it is indeed
Code:
int main(int argc,char* argv[])
It's working now (sort of), and I'm actually thinking about maybe taking this further and making a simple Q/A-based AI out of it (with hard-coded answers; nothing too special).
Anyways, I'll go ahead and shut up about it now; it's working, and there's no reason I should be hijacking the thread anymore.
It's working now (sort of), and I'm actually thinking about maybe taking this further and making a simple Q/A-based AI out of it (with hard-coded answers; nothing too special).
Or, indeed, special at all.
What I am doing now: being honest and an arsehole :P
Last edited by carbonfiber; 01-16-2010 at 03:50 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.