+ 5

[DUPLICATE] What are pointers used for

What are the practical uses of the pointer and when should I use them?

23rd Feb 2018, 12:50 PM
Kudzayi Mberi
Kudzayi Mberi - avatar
2 Answers
+ 5
Pointer are references to variable. char *msg = "Hello world"; // this(msg) holds the reference (memory location) of char 'H' You should use them when size of input is a variable, like names, messages, etc. For example: char *name; // this pointer to variable "name" can hold large amount of characters
23rd Feb 2018, 2:24 PM
777
777 - avatar