Hello members, I purchased the book "Let us C" (a great book so far) and i'm in the process on learning C, but i have a pair of questions for anyone with a little free time who can help me. What is the correct way for declarating the main funcion? I have seen examples like these: [void main(void)], [int main()] and [int main(void)]. The book uses the second example but i think the most standard and current way is: int main(), i'm correct? Another question is about the return function. I have seen examples like these: [return(var)] and [return var]. Should i use parentheses on return? Thanks in advance.
1. [int main(void)] & [int main()] both are the same. here the return type is integer and main is void. 2. [void main(void)] here the return type and main both are void.
i agree with techme. he has said the right thing. you have to implement the header file where it needed.
as techme said both int main()and int main(void) are same but u have to return a value. like return 0; void main() and void main(void)are same here u should not use return 0; and parenthesis is not mandatory while returning. the above both return statements are valid.