| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // 포인터를 통한 구조체 참조 #include <stdio.h> struct student { int number; char name[20]; double grade; }; int main(void) { struct student s = { 20070001, "홍길동", 4.3 }; struct student *p; p = &s; printf("학번=%d 이름=%s 학점=%f \n", s.number, s.name, s.grade); printf("학번=%d 이름=%s 학점=%f \n", (*p).number, (*p).name, (*p).grade); printf("학번=%d 이름=%s 학점=%f \n", p->number, p->name, p->grade); return 0; } | cs |


https://itsys.hansung.ac.kr/cgi-bin/onlineTest/viewCcoding/onlineCcoding.cgi?source=src/chap11/pointer_to_st.c
C프로그래밍(프로그래밍언어) 실습게시판