Thread: Common Problems

  1. #1
    Registered User
    Join Date
    Nov 2002

    Common Problems

    Even though I have only been here a little while, I have seen the same problems repeatedly. Hence, I created this thread to point them out and explain them.

    Q) Why am I having trouble compiling a program that uses conio.h?

    A) Conio.h is a non-standard header. Hence, using any function in it might cause your compiler to choke b/c it doesn't have the function defined. If using dev-c++, try including mingw_conio.h or conio.c.

    Q) People tell me void main is bad, why?

    A) Main is defined to return an int. There is no other option. If your compiler accepts it, it is either 1) old and adheres to older standards that did accept it, or 2) is wrong. Returning a value is important to the OS. If the program succeeds (aka it doesn't crash or have a fatal problem), it should return 0 or EXIT_SUCCESS. If it fails, return a non-zero value or EXIT_FAILURE. Failure to do this makes your program undefined and can lead to weird behavior. The exception to the rule occurs in C++, where main automatically returns 0 if it is defined to return an int and there is no return statement. However, since few compilers are truly ANSI-C++, your compiler might choke if you don't include it.

    Q) I don't have header (any name), can I download it from someone.

    A) Header files are usually only functional on the compiler it was made for. Also, these headers are (normally) linked to library files that contains all of the code for the functions. So, downloading a header file is probably not possible.

    If anyone else finds any others that should be added, feel free to add to the list.

    Will a Moderator please add this as an announcement to hopefully further prevent these common problems.

    Also one other thing that I have noticed is that people who are taking some sort of class in C are coming to the board to get the answer to their homework. You will not learn C if you are copy pasting someone elses code. You must do your own programs b/c in the end when you have finished it knowing that you did it, it will mean that much more to you than another. You come to this board to ask questions on how to do a thing but only after atempting to do it i.e. "Hello I am haveing trouble understanding how i would go about linking two lists together. Here is my code so far and I believe i should go about doing it this way. What do you think?" That would be a good way to ask a question. A bad way would to say "Hey. We got an assignment today to create a linked list to save employees names and id numbers. Show me how to do it." You will get no help this way nor will you get anything accomplished except for a grade.
    Last edited by WolfPack; 11-28-2002 at 12:08 AM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    While it's a great idea, sadly I believe you're wasting your time. Most people never read the rules of the forum or if they do, they totally disregard them. Additionally, there is a FAQ which covers some things, and again, no one reads it either.

    This tends to make my replies very to the point, "You're a moron. Go away.", which annoys Kermi

    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Aug 2002
    hehe, I read it. Just gone through over 200 threads looking for answers. Some really good information stuffed away on this forum. Shame more people don't take the time to look through.

    Some really nice code snippets too.


  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    >>Will a Moderator please add this as an announcement
    Like quzah said, an FAQ exists already, plus I'm also working on a new one; and there's also an FAQ board.

    If you have any other things you'd like to see in it, PM me with the details.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    Aug 2002
    I will if I find something I think is missing.

    Thanks again,


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to handle multiple cases which use common code?
    By tmaxx in forum C Programming
    Replies: 3
    Last Post: 10-03-2008, 07:42 AM
  2. common functions
    By FoodDude in forum C++ Programming
    Replies: 3
    Last Post: 09-22-2005, 02:13 PM
  3. Integration problems
    By Shiro in forum A Brief History of
    Replies: 33
    Last Post: 01-14-2003, 02:32 PM
  4. Lowest Common Factor
    By PJYelton in forum C++ Programming
    Replies: 9
    Last Post: 12-23-2002, 09:30 AM
  5. Coding Problems
    By RpiMatty in forum C++ Programming
    Replies: 12
    Last Post: 01-06-2002, 02:47 AM