c - Why &a is illegal l-value and why it is used in scanf() function then -
c - Why &a is illegal l-value and why it is used in scanf() function then -
i'm studying pointers in c, , i'm finding topics confusing. searched google , particular site not understand them.
i have questions regarding forms variable take:
1) difference between a=2 , &a=2 ? 2) why &a
used l-value illegal?
as far understand, &a=2;
illegal , &a illegal l-value because &a contains memory address not memory contents. , since memory address in form of integer hence can't assign value integer.
3) happens in scanf()
function then?
i mean if take illustration scanf("%d",&a);
. why &a
used here, why not *(&a)
. why compiler not show kind of error?
please please help , explain :)
you cannot assign value &a
, because &a
denotes address variable a
stored, , address determined 1 time , @ programme start , can't changed.
when using scanf
, want 1 or more variables modified scanf
function. hence must pass address of variables modified scanf
.
c
Comments
Post a Comment