Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.2 kB
4
Indexable
Never
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
//    printf("Hello world!\n");
//    int x, *p1, **p2;
//    x = 100;
//    p1 = &x;
//    p2 = &p1;
//    printf("%d \n%d \n%d \n%d \n%d \n%d \n%d \n%d", x, &x, p1, *p1, p2, *p2, &p1, **p2);

    printf("\n");
//    int a = 1, *b;
//    b = &a;
//    int *c = &a;
//    int *y = 10;
//
//    printf("a=%d\n&a=%d\n b=%d\n*b=%d\n", a, &a, b, *b);
//    printf("c=%d\n*c=%d\n", c, *c);
//    printf("*y = %d\n = %d\n", *y, y);

    puts("");
//    char arr[] = {'a', 'b', 'c'};
//    int *ptr = arr;
//    char *add = arr;
//    printf("%d %d %c", ptr, add, add);

    puts("");
    int *ptr1;
    int volt = 12, current = 6, resistance = 2;
    ptr1 = &volt;
    int *ptr2;
    ptr2 = &current;
    int *ptr3;
    ptr3 = &resistance;

    int num = 100;
    int *ptr4;
//    *ptr4 = num;
    ptr4 = &num;

    int *ptr5;
    ptr5 = &num;
    int *ptr6;
    *ptr6 = 25;

//    printf("ptr1: %d ptr2: %d ptr3: %d *ptr1: %d *ptr2: %d *ptr3: %d", ptr1, ptr2, ptr3, *ptr1, *ptr2, *ptr3);
    puts("");
    printf("ptr4: %d *ptr4: %d ptr5: %d *ptr5: %d ptr6: %d *ptr6: %d", ptr4, *ptr4, ptr5, *ptr5, ptr6, *ptr6);

    puts("");
    return 0;
}