minseo-jung / study-c

0 stars 0 forks source link

int형 변수를 선언하고 초기화 후 간접 접근방식으로 1감소 시킨 후 포인터 서로 변환 #33

Open minseo-jung opened 5 years ago

minseo-jung commented 5 years ago
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

void p12_1_1()
{
    int a = 10;
    int b = 20;
    int c = 0;
    int *p1 = &a;
    int *p2 =&b;
    *p1 = *p1 - 1;
    *p2 = *p2 - 1;
    c = *p1;
    *p1 = *p2;
    *p2 = c;
    printf("%d %d", *p1, *p2);
    return;

}