0

Pointer Details

What is Pointer ? I want learn the clear concept.

2nd Jul 2019, 5:15 AM
Sourav Paul
Sourav Paul - avatar
2 Answers
+ 1
A pointer is a variable that points to a memory location. You can create a pointers like this: int x = 5; int* y = &x; & is used to access the variable's memory location, and the int* means that y will point to an integer. y will track x, no matter what. Printing y will mostly give you a "nonsensical" number, since it is the memory location, and you can't do anything with it. To actually show the value, you have to again use the asterisk: printf("%d", *y); //This will output 5
2nd Jul 2019, 5:25 AM
Airree
Airree - avatar
0
Thank a lot Airree
2nd Jul 2019, 5:27 AM
Sourav Paul
Sourav Paul - avatar