티스토리 뷰

int *pnData;

--  -------

 2        1

1 : 포인터 변수

2 : 대상의 자료형식


다차원 배열 :  배열의 배열

                    ----

               같은 형식의 자료가 여러개 모인 것

char[4][12]

       --  ---

         2    1

12개짜리가 4행 있다



중요)

char aList[3][12] = { "aaa", "bbb", ........ }

        -------

            1

> 1:  aList[3]

> 2: char    [12]    -> 요소형식


char (*pList)[12] = aList;  


ex)

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>


int main(void)
{


 char astrList[2][12] = { "Hello", "World" };

 char(*pstrList)[12] = astrList;

 puts(pstrList[0]);
 puts(pstrList[1]);


 return 0;
}

-------------------------------------------------------


World


}

#include <stdio.h> 
#include <stdlib.h>
#include <string.h>


void PrintUser(char(*pUser)[12])
{
 for (int i = 0; i < 3; ++i)
  puts(pUser[i]);
}

int main(void)
{
 char astrList[3][12] = { "철수", "길동", "영희" };

 PrintUser(astrList);


 return 0;
}

-----------------------------------------------

철수
길동
영희








댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함