Untitled

 avatar
unknown
plain_text
a year ago
489 B
10
Indexable
#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;
}
Editor is loading...
Leave a Comment