0

Help me with c arrays and pointers

My below code doesn't work. Anyone explain me, 1) The reason for it's failure 2) How to fix this https://code.sololearn.com/cO5ghlBOc3A4/?ref=app

22nd May 2021, 1:06 AM
Rishi
Rishi - avatar
4 Respostas
+ 3
pointers should equal memory addresses https://code.sololearn.com/cForI9XPEtDI/?ref=app
22nd May 2021, 1:13 AM
Slick
Slick - avatar
+ 2
Rishi see here int number =1; //normal integer variable int *ptr ; //ptr is pointer variable ptr=&number; //ptr store's the address of variable number // pointer points to an address of a variable *ptr=*&number; //by dereferencing ptr gives the value stored at address which was pointing //so *ptr =1 ;
22nd May 2021, 1:57 AM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
+ 2
Thirt13n yeah thanks
22nd May 2021, 6:13 AM
Rishi
Rishi - avatar
0
Thirt13n yeah I know that but I'm trying to learn how Actually memory allocation works in C.
22nd May 2021, 1:29 AM
Rishi
Rishi - avatar