Thread: C subroutine

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    55

    C subroutine

    If i have declared void test( p, a, b, c, n) as a subroutine, how to call that subroutine in main program?

    Thank you in advance.

  2. #2
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    test(p, a, b, c, n);

    please note that when you call the subroutine the vairables don't have to be named p, a, b, c, and n but there needs to be 5 of them
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #3
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by curious View Post
    If i have declared void test( p, a, b, c, n) as a subroutine, how to call that subroutine in main program?

    Thank you in advance.
    You declare it like this
    Code:
    void test(int,int,int,int,int);//assuming all of your variables are of integer type
    While calling in main
    Code:
    test(p,a,b,c,n);
    BTW in C subroutines are called "functions".
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling Java Subroutine
    By thetinman in forum C++ Programming
    Replies: 11
    Last Post: 10-14-2008, 11:52 AM
  2. AIX passwdpolicy() subroutine
    By syndex in forum C Programming
    Replies: 1
    Last Post: 10-06-2008, 06:04 PM
  3. Assembler Language Subroutine 2
    By John_L in forum Tech Board
    Replies: 8
    Last Post: 03-30-2008, 04:48 PM
  4. problem with subroutine
    By pankleks in forum C Programming
    Replies: 2
    Last Post: 11-24-2005, 02:57 AM
  5. fgets in a function subroutine
    By wbeasl in forum C Programming
    Replies: 1
    Last Post: 12-03-2003, 03:51 AM