Pointer Data Type
If I want to store the address of a variable, then what data type should I use to declare another variable? - Here is the solution.
Solution is…
If we declare a variable to store the address of a value (i.e., a pointer), the data type of the pointer must match the data type of the value. For example, if we store the number 4
(which is an integer), and we want to store the address of that integer, we must declare a variable with the data type int*
to store the address of the number 4
, because 4
is an integer.
Same with other data types.
If we declare a variable to store the address of a character value (i.e., a character pointer), the data type of the pointer must match the data type of the value. For example, if we store the character 'A'
(which is of type char
), and we want to store the address of that character, we must declare a variable with the data type char*
to store the address of the character 'A'
, because 'A'
is a character.
I have confirmed the solution that i explaining, still if you think something is not correct, feel free to contact me. Thank You for Your Time.
Subscribe to my newsletter
Read articles from Sandeep Raveendra Kolli directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by