C program common errors
Sometimes, we may not get the desired output. If the syntax and other things are correct, then also, we may not get correct output due to some logical issues. These are called the logical error. Sometimes, we put a semicolon after a loop, that is syntactically correct, but will create one blank loop. In that case, it will show desired output. This kind of error occurs when it is syntactically correct but has no meaning. Related Articles. Table of Contents. Improve Article. Save Article.
Like Article. This article is contributed by Krishna Bhatia. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.
See your article appearing on the GeeksforGeeks main page and help other Geeks. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Remember, semicolons don't go after if statements, loops, or function definitions.
If you put one in any of those places, your program will function improperly. For example, if you have a ten element array, the first element is at position zero and the last element is at position 9. Even though value is 10 the program loops.
In fact, the statement given above is a tautology; it is always true that value is not equal to 10 or not equal to 20 as it can't be both values at once. A quick bit of boolean algebra will help you immensely:! A B is the equivalent of! The sentence "value is other than [ten or twenty]" brackets added to show grouping is translatable to!
0コメント