what is difference bt
void main(int)
int main()
and some more
please someone explain various types
i want to know how each function statements effects the program
C language help!?
void main(int) - is the signature of a program that takes an integer as an argument and does not return anything.
int main() - is the signature of a program that takes zero arguments and returns an integer.
I'm referring to the signature of the main function as the signature of the program.
You can get more info at www.cprogramming.com/tutorial.html
Reply:int - integer
void - no value
string - string
double - real number
float - real number
type funtionName(arguments)
type is the return type. A value of that type must be returned by the function, unless the return type is void. In this case no value needs to be returned.
functionName is self explanatory.
arguments would be the arguments supplied to the function and hence can be used within the function. Their scope is only within the function unless an argument is passed by reference.
Reply:All of the above is true, but main() is special.
main is a function that returns int.
main also takes, as arguments, a count of the arguments passed it, and each of those arguments (each is a pointer to character)
main looks like this:
int main(int argc, char **argv)
where argv is an array of pointers to character.
or, alternately:
int main(int argc, char *argv[])
(the arguments don't have to be called argc and argv... that's just a convention. This is also valid:
int main(int count, char *arguments[])
or
int main(int how_many_arguments_we_have, char *the_arguments_we_got[])
)
pokemon cards
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment