Thread: errors in c

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    6

    Lightbulb errors in c

    I just need some information about all kinds of usuall (syntax,logic,...)errors in c and how to correct them.

  2. #2
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    Posts
    435
    No problem. I'll just tell you everything I know about things that took me years to learn, and which I still don't know 1% of everything about, because you asked so vaguely for everything and couldn't be bothered to Google, say, "common C errors" or similar?

    Just what kind of response were you expecting?

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

  3. #3
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by aliok View Post
    I just need some information about all kinds of usuall (syntax,logic,...)errors in c and how to correct them.
    Then you should spend a few years writing C programs.
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    144
    Write programs. Your bound to make mistakes. When you do, copy/paste the errors into google. You should get alot of hits with users having gone through the same problem

  5. #5
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by bos1234 View Post
    Write programs. Your bound to make mistakes. When you do, copy/paste the errors into google. You should get alot of hits with users having gone through the same problem
    Ah... now that is a real solution to cure segmentation faults. After all, all those getting it must be making the exact same mistake. :S

  6. #6
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Heh, I need my car battery replaced.. wait why am I posting here?
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  7. #7
    Registered User
    Join Date
    Apr 2012
    Posts
    6
    Never mind I figured it out. Thanks anyways. I don't know how to delete posts so that is why I didn't.

  8. #8
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why am I getting these errors??
    By maxthecat in forum Windows Programming
    Replies: 3
    Last Post: 02-03-2006, 01:00 PM
  2. Errors!
    By maxorator in forum Windows Programming
    Replies: 3
    Last Post: 12-15-2005, 08:59 PM
  3. Help with errors
    By sublime in forum C Programming
    Replies: 11
    Last Post: 11-11-2005, 03:23 PM
  4. errors.. errrors.. more errors
    By Klinerr1 in forum C++ Programming
    Replies: 17
    Last Post: 07-23-2002, 08:43 PM
  5. Dev and errors
    By Moffesto in forum C++ Programming
    Replies: 0
    Last Post: 06-22-2002, 12:17 AM

Tags for this Thread