최대 1 분 소요

#include <stdio.h>

struct test
{
	int a, b;
};

int main()
{
	struct test st;
	struct test* ptr;   // struct test 는 int,double,char과 같은 자료형이라고 생각하면 된다. (ㄹㅇ이렇게 생각하면 쉽다)

	ptr = &st;

	(*ptr).a = 1;
    ptr->a = 5;        // 위와 동일
  
	(*ptr).b = 2;
	ptr->b = 3;        // 위와 동일

	printf("%d\n%d\n", (*ptr).a, (*ptr).b);

	return 0;
}

아니 왜 이렇게 코드가 크게 나오지??

태그:

카테고리:

업데이트:

댓글남기기