Thread: C function

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    Smile C function

    Hi , i want to ask if for example we have a C program that contains both main() and a function
    , is it possible to write the main() in one file and then writing the function in another file? and when the main() executes , it calls the function and compile and run it? assuming that the compiler is Turbo C++ for DOS or i wish that there is a common method to do this procedure for all kinds of compilers even the GCC for Linux ?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    C functions

    You already asked this, and we already answered this. Knock it off.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Sep 2009
    Location
    USA
    Posts
    63
    yea

    jus insert the name of the header file in the starting of the code

    #include "name"

    the cygwin command for compiling is gcc headerfile.h main.c

  4. #4
    Registered User
    Join Date
    Oct 2009
    Posts
    3
    I searched before asking again....."Knock it off" is not a legal C code !

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by ssaif View Post
    I searched before asking again....."Knock it off" is not a legal C code !
    What's your point? If there's something you don't like about the answers you got the first time, then perhaps you should state what about them confuses you, or what difficulties you are still having. Asking the same question again, is going to get you the same answers again, assuming anyone will bother to answer (hint: they won't).

  6. #6
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    i think u should search the forum for ur query first before posting any query here

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM