Thread: Functions in a switch case...

  1. #1
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204

    Thumbs up Functions in a switch case...

    Why is it this doesn't work?

    Code:
    int func()
    {
          return 1;
    }
    
    //...
    
          switch (input)
          {
                case func():
                      //...
                      break;
          }
    Thanks in advanced!

  2. #2
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Because this is wrong !
    case takes only some constants (int,char)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 03-05-2009, 11:32 AM
  2. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. switch case statement
    By stanlvw in forum C++ Programming
    Replies: 3
    Last Post: 02-26-2008, 05:06 AM
  5. Intel syntax on MinGW ?
    By TmX in forum Tech Board
    Replies: 2
    Last Post: 01-06-2007, 09:44 AM