Thread: Calling A Funtion

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    28

    Calling A Funtion

    Can anyone see whats wrong with the following code its not running the displaymenu function its going striahgt over it I think

    Code:
    #include <stdio.h>
    
    int displaymenu ();
    
    
    int main ()
    {
       puts("BeforeMenu");
       displaymenu;
       puts("AfterMenu");
       return (0); 
    }
    
    
    
    int displaymenu ()
    {
       puts ("\n\tP System");
       puts ("\n\n\t1) Add Entry");
       puts ("\n\t2) Delete Entry");
       puts ("\n\t3) Find Entry");
       puts ("\n\t4) View List");
       puts ("\n\t5) Sort Entries");
       puts ("\n\n\ttQ) Quit");
       puts ("\n\n\t Enter Selection");
    
       return(0);

  2. #2
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Code:
       puts("BeforeMenu");
       displaymenu();
       puts("AfterMenu");
       return (0);
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    28
    What does it do when I just call displaymenu? Is displaymenu a pointer and displayermenu() a function call then?

  4. #4
    Wannabe Coding God
    Join Date
    Mar 2003
    Posts
    259
    where did the last
    Code:
    }
    go in desplaymenu ?
    They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    28
    Thanks I understand now, are there situations when you want to call a function by its pointer then? GCC wasnt giving me any warnings.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack issues when calling a COM library
    By notnot in forum C Programming
    Replies: 3
    Last Post: 06-01-2009, 02:12 AM
  2. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  3. calling default instead of argument constructor, why?!
    By cppn00b in forum C++ Programming
    Replies: 6
    Last Post: 01-30-2005, 04:24 AM
  4. calling conventions
    By Micko in forum C Programming
    Replies: 2
    Last Post: 07-18-2004, 09:13 AM
  5. Question on function syntax and calling function
    By cbrman in forum C Programming
    Replies: 10
    Last Post: 10-05-2003, 05:32 PM