C언어 화살표 연산자

John Jeong (토론 | 기여)님의 2018년 2월 20일 (화) 22:17 판
C언어 화살표 연산자, 멤버 연산자
C Language arrow operator, member operator
  • 구조체 포인터에서 포인터가 가리키는 멤버를 가리킬때 사용

1 예시

#include <stdio.h>

struct posTag {
    int x;
    int y;
};

int main()
{
    struct posTag a = {1, 2};
    struct posTag *pa = &a;

    printf("pa->x = %d, (*pa).x = %d\n", pa->x, (*pa).x);
    printf("pa->y = %d, (*pa).y = %d\n", pa->y, (*pa).y);

    return 0;
}

2 같이 보기

  • C언어 강좌
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}