+ 4

pointers

"The asterisk sign can be placed next to the data type, or the variable name, or in the middle." Could anyone explain this?

16th May 2020, 12:00 PM
Kumudu_Mohottala
Kumudu_Mohottala - avatar
2 Answers
+ 6
It means you can declare pointers like: int* ptr; //next to data type int *ptr; //next to the variable name int * ptr; //middle
16th May 2020, 12:14 PM
CarrieForle
CarrieForle - avatar
+ 2
The asterisk sign is used to declare a pointer (the same asterisk that you use for multiplication), however, in this statement the asterisk is being used to designate a variable as a pointer.
20th May 2020, 4:58 AM
Ketan Pal
Ketan Pal - avatar