Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
489 B
8
Indexable
Never
#include <stdio.h>

int main() {
    int x = 10;
    // ptr holds the memory address of x
    int *ptr = &x; 
    // Output: the value of x
    printf("    x: %d \n",x) ; 
    
    // Output: the value of the variable that ptr points to
    printf(" *ptr: %d  \n",*ptr); 
    
    //Output: Address of x
    printf("  ptr: %p  \n",ptr); 
    
    // Output: Address of x
    printf("   &x: %p  \n",&x); 
    
    // Output: Address of ptr
    printf(" &ptr: %p  \n",&ptr); 
    return 0;
}
Leave a Comment