C Programming - Pointers - Discussion

Discussion Forum : Pointers - Point Out Errors (Q.No. 2)
2.
Point out the error in the program
#include<stdio.h>

int main()
{
    int a[] = {10, 20, 30, 40, 50};
    int j;
    for(j=0; j<5; j++)
    {
        printf("%d\n", a);
        a++;
    }
    return 0;
}
Error: Declaration syntax
Error: Expression syntax
Error: LValue required
Error: Rvalue required
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
65 comments Page 6 of 7.

Jagan said:   10 years ago
A is constant pointer it is not possible to increment.

Spoorti said:   9 years ago
@Shri.

Good explanation. I got it clearly.

Veeraselvi said:   1 decade ago
What you mean by Lvalue & Rvalue?

Balaji said:   1 decade ago
I am not understand explain clearly.

Atul yadav said:   1 decade ago
Simply replace a++; with a[j]++;

Suresh said:   1 decade ago
Where is l here, wat is that?

Rakshitha said:   4 years ago
Explain the answer clearly.
(1)

Thiyagu said:   1 decade ago
Nice explanation from sam.

Sugan said:   1 decade ago
What is lvalue and rvalue?

Deepak said:   9 years ago
LValue means Left value.


Post your comments here:

Your comments will be displayed after verification.