Thread: why is "void main" wrong?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Unregistered
    Guest

    why is "void main" wrong?

    ?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Take a look at this code. When you figure out how dumb it is then you'll understand why void main is wrong.
    Code:
    void strcmp ( const char *src, const char *dst )
    {
      int ret = 0;
      while( !( ret = *src - *dst ) && *dst )
        ++src, ++dst;
        if ( ret < 0 )
          ret = -1;
        else if ( ret > 0 )
          ret = 1;
    }
    -Prelude
    My best code is written with the delete key.

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    So THAT's how strcmp is constructed? No wonder it never works for me
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM