Else without IF
This error is shown if we write anything in between if and else clause.
prog.c: In function 'main': prog.c:15:5: error: 'else' without a previous 'if' else printf("value of a is not equal to 2 "); ^
This error occurs when we put constants on left hand side of = operator and variables on right hand side of it.
prog.c: In function 'main': prog.c:6:5: error: lvalue required as left operand of assignment 10 = a; ^
Example 2: At line number 12, it will show an error L-value because arr++ means arr=arr+1.Now that is what their is difference in normal variable and array. If we write a=a+1 (where a is normal variable), compiler will know its job and their will be no error but when you write arr=arr+1 (where arr is name of an array) then, compiler will think arr contain address and how we can change address. Therefore it will take arr as address and left side will be constant, hence it will show error as L-value required.
prog.c: In function 'main': prog.c:10:6: error: lvalue required as increment operand arr++; ^
- lvalue and rvalue in C language
- How to find Segmentation Error in C & C++ ? (Using GDB)
- Program error signals
- Error Handling in C programs
- Segmentation Fault (SIGSEGV) vs Bus Error (SIGBUS)
- Why strict aliasing is required in C ?
- C Program for Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane
- Dividing a Large file into Separate Modules in C/C++, Java and Python
- C program to store Student records as Structures and Sort them by Name
- Check whether the given character is in upper case, lower case or non alphabetic character
- Similarities and Differences between Ruby and C language
- Program to copy the contents of one array into another in the reverse order
- Interesting facts about C Language
- Program to Reverse a String using Pointers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.