type in a code to declare a pointer 'ptr ' to int and assign it value to var's address | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

type in a code to declare a pointer 'ptr ' to int and assign it value to var's address

int var =25 int ___ ptr = ___ var;

21st Aug 2018, 1:23 AM
Panshak Yabal
Panshak Yabal - avatar
5 Answers
+ 5
* &
20th Apr 2020, 5:06 AM
Adepoju Abiodun
+ 3
Did you mean "assign var's address to a pointer"? Then int *ptr = &var; is the solution. You can declare a pointer using asterisk (*). & gives the variable's address.
21st Aug 2018, 2:03 AM
Steppenwolf
Steppenwolf - avatar
+ 2
Please explain what you do not understand, show your attempts, instead of asking for answers straight off the bat.
21st Aug 2018, 2:02 AM
Hatsy Rei
Hatsy Rei - avatar
0
int var = 25; int *ptr = &var;
12th Dec 2020, 7:49 AM
Ricardo M Delgado
Ricardo M Delgado - avatar
0
in the first slash * and in the second one u addressing the variable to the pointer so amperson & final answers were= * , &
7th Aug 2021, 6:19 PM
Seela Lokesh
Seela Lokesh - avatar