반응형

 

//*******************************************************************
//구조체 배열!!!
//*******************************************************************
#include <stdio.h>
#include <string.h>

typedef struct Student
{
      int Snum;//학번
      int age;//나이
      int Grade;//학년
      char name[20];//이름 
}STUDENT;
 

void main()
{
      STUDENT BitList[5];

      BitList[0].age = 20;
      BitList[0].Grade = 1;
      strcpy(BitList[0].name,"호길동");
      BitList[0].Snum = 1000;
 //BitList : 포인터를 통한 접근!!!

      printf("age : %d ", BitList->age);
      printf("age : %d ", (*BitList).age);

 //->구조체의 포인터일 경우 ->연산자를 사용한다!!

}

by 훈강

반응형

'프로그래밍 > Language C' 카테고리의 다른 글

[C언어] 구조체 리뷰  (0) 2011.11.15
[C언어] TypeDef 키워드  (0) 2011.11.15
[C언어] 구조체  (0) 2011.11.15
[C언어] 포인터 #2  (0) 2011.11.15
[C언어] 포인터 #1  (0) 2011.11.15