Dilbert said:
Hi there, was just wondering whats the best way to call a function from
within another function.
say ive got
int main (int argc, char * argv[]) {
return 0;
}
and another function such as:
void getInput(char name) {
printf("Hello");
this printf() is a function, so thats a function within a function
.....................
}
and i wanted it, so as soon as the program starts it goes straight to the
getInput function..
i tried; in the main function:
getInput(char name);
void getInput(char name);
getInput;
getInput();
none seemed to work
getInput requires a char, now there are three things wrong here,
1) a char can only hold one character, so this should accept a char pointer
or a char array to hold a name
2) the function name does not hint what the function does, its called
getInput but doesnt actually get any input.
3) You pass a paramater (char name) and never actually use it
All in all, I suggest you get yourself a book in c (I dont recommend K&R as
your first book, but you should read it eventually), and study up a bit
more.
HTH
Allan