* 포인터 배열
int main2()
{
char* sesason[4] = {"Spring","Summer","Fall","Winter"};
int idx;
for (idx = 0; idx != 4; idx++)
{
printf("%s\n",sesason[idx]);
}
return 0;
}
#include <stdio.h>
#define MAX_STD 5 // MAX_STD == 5라는 뜻
#define NAME_LEN 25 // NAME_LEN == 25라는 뜻
int main(void)
{
char stdbuf[MAX_STD][NAME_LEN] = { 0, }; // char stdbuf[5][25] = {0,};
char* strptr[MAX_STD];
char* temp = NULL;
int idx = 0;
int jdx = 0;
// puts : 문자열 출력할 때 쓰는 함수 ""안에 string만 쓸 수 있다. only string!
puts("학생 이름 입력 : ");
while (idx != MAX_STD)
{
fflush(stdin);
fgets(stdbuf[idx], sizeof(stdbuf[idx]), stdin);
strptr[idx++] = stdbuf[idx];
}
// 문자열 오름차순 정렬
return 0;
}
'C' 카테고리의 다른 글
2020.11.05 - C (0) | 2020.11.05 |
---|---|
2020.11.03 - C (0) | 2020.11.03 |
2020.10.29 - C (0) | 2020.10.29 |
2020.10.23 - C (0) | 2020.10.23 |
2020.10.22 - C (0) | 2020.10.22 |