Why are pointers defined as int data type? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why are pointers defined as int data type?

What other variable types is the int type used for, other than actual integers

18th Feb 2019, 7:11 AM
Xoe Riphenburg
Xoe Riphenburg - avatar
1 Answer
+ 4
Pointers can have any type, even void which is the absence of a type. int* (pointer to int) informs the compiler that the value stored at the memory address is an integer. Unless the type of the value is specified, the data at the memory address can't be used
18th Feb 2019, 7:58 AM
Anna
Anna - avatar