Basic C tutorial for non-programmers - Page 2
Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Basic C tutorial for non-programmers

  1. #11
    AO Antique pwaring's Avatar
    Join Date
    Aug 2001
    Posts
    1,408
    Originally posted here by lepricaun
    well, i did a little research, and as you can see, it is preffered to use main(void) if not using arguments.
    It is not incorrect (nor will you get any warnings) if you use int main() over int main(void), which was the point I made in the first place. It might be preferred by some people but that's just like saying I prefer to put my curly braces on lines of their own whereas other people don't.
    Paul Waring - Web site design and development.

  2. #12
    well i wouldn't trust it since it is possible that a compiler might complain..

    but that's everyone's own choice, i just prefer main(void) over main(), (this also goes for all other functions that have no arguments).

    and i also prefer this code:
    Code:
    #include <stdio.h>
    
    int main(void)
    {
               printf("Hello World!\n");
               return 0;
    }
    over this code:

    Code:
    #include <stdio.h>
    int main(void){printf("Hello World!\n");return 0;}
    although both are the same...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides