Pointer Arithmetic

#include <stdio.h>

int main() {
    // Pointer arithmetic
    int numbers[] = {1, 2, 3, 4, 5};
    int *ptr = numbers;

    printf("First element: %d\n", *ptr);
    printf("Second element: %d\n", *(ptr + 1));
    printf("Third element: %d\n", *(ptr + 2));

    return 0;
}
chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website