Print value and address of pointer defined in function?

后端 未结 5 1950
[愿得一人]
[愿得一人] 2021-02-07 23:29

I think this is a really easy thing to code, but I\'m having trouble with the syntax in C, I\'ve just programmed in C++.

#include 
#include 

        
5条回答
  •  梦如初夏
    2021-02-08 00:04

    Address are some memory values which are written in hexadecimal notation starting with 0x

    /Value pointed to by the pointer iptr/

    printf("Value is: %i", *iptr);
    

    Address pointed to by the pointer will be the value of the iptr pointer itself

    /print the address pointed to by the iptr/

     printf("Address is: %p", iprt);
    

    /print the address of iptr itself/

     printf("Address of iptr: %p", &iptr )
    

提交回复
热议问题