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.
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 ;)
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. :)
>>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.
I will if I find something I think is missing. :)