The only difference between pointers of different data types is the data type of the variable or constant that the pointer points to. The actual data type of the value of all pointers, whether integer, float, character, or otherwise, is the same, a long hexadecimal number that represents a memory address. Take a look at some of the valid pointer declarations − However, in this statement the asterisk is being used to designate a variable as a pointer. The asterisk * used to declare a pointer is the same asterisk used for multiplication. Here, type is the pointer's base type it must be a valid C data type and var-name is the name of the pointer variable. The general form of a pointer variable declaration is − Like any variable or constant, you must declare a pointer before using it to store any variable address. When the above code is compiled and executed, it produces the following result −Ī pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location.
Printf('Address of var2 variable: %x\n', &var2 ) Printf('Address of var1 variable: %x\n', &var1 )