Doubt in c

This is a discussion on Doubt in c within the C Programming forums, part of the General Programming Boards category; anyone can help me, how to include a "C" file which already contains main() function to another one....

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    1

    Question Doubt in c

    anyone can help me, how to include a "C" file which already contains main() function to another one.

  2. #2
    Registered User
    Join Date
    Jan 2007
    Posts
    8

    Thumbs down not possible

    hi ,,,

    i think according to me it is not possible since there will be a conflict between the main functions

    wish u get an answer for this question

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    there is no need to "include" C-file into another one, in the first place
    it can be done, but there is no need to do it in 99% of the cases
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    Registered User
    Join Date
    Apr 2006
    Posts
    2,053
    Make a project. Use preprocessor conditionals to mark which main block to use. Do not #include 1 .c file in another.
    The preprocessor directives you want are #if, #endif, and #ifdef. There are others you can use too.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  5. #5
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,695
    You can call other C code from your code. Read FAQ about that.

    ssharish2005

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doubt in pointer.
    By shwetha_siddu in forum C Programming
    Replies: 5
    Last Post: 03-21-2009, 02:28 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. Doubt abt Storage!
    By kalamram in forum C Programming
    Replies: 1
    Last Post: 04-21-2006, 06:30 AM
  4. arrays doubt
    By j0nnyX in forum C Programming
    Replies: 4
    Last Post: 11-20-2004, 01:10 PM
  5. Greatest C++ Doubt
    By vasanth in forum C++ Programming
    Replies: 15
    Last Post: 02-28-2002, 04:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21