Creates a pointer and then changes the value inside

PHOTO EMBED

Mon Aug 21 2023 19:59:52 GMT+0000 (Coordinated Universal Time)

Saved by @fujoe #c

#include <stdio.h>

int main() {
    int num = 42;     // An integer variable
    int *pointer;         // A pointer to an integer

    pointer = &num;       // Store the memory address of 'num' in 'ptr'

    // *ptr = 10;        // Change the value of 'num' to 10 through the pointer

    printf("num: %d\n", *pointer);  // This will output "num: 10"

    return 0;
}
content_copyCOPY