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;
}
Discussion:
65 comments Page 5 of 7.
Gouri said:
1 decade ago
Why L value is required? Please can any one explain me, I can't understand this question.
Jagan said:
1 decade ago
Here LValue means a[].
We have to specify printf("%d",a[i]); instead of 'a'.
We have to specify printf("%d",a[i]); instead of 'a'.
Sunil said:
9 years ago
Trying to increment or decrement constant expression then Lvalue required error occurs.
Deepali said:
1 decade ago
A is memory address & we can not use %d for address. We have to use unsigned int.
Kiran said:
1 decade ago
Can any one explain what exactly lvalue and rvalue means ?im not getting them?
Satish said:
2 decades ago
Hey this is difficult one. I can explain this after seeing in the text book
Shweta said:
7 years ago
Array is a constant pointer so we can't increment or decrement an array.
Jana said:
10 years ago
Friends, whether we can assign a pointer to a pointer.
Eg:
{
*b=*a;
}
Eg:
{
*b=*a;
}
Apurva Nigam said:
1 decade ago
Can anybody please explain what are Lvalue, Rvalue required errors?
Chandru said:
1 decade ago
@Sudha, can you please explain me with example program?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers