STUDYING/C [C] 기초 개념 다지기 - array l_j_yeon 2017. 10. 1. 12:45 #include int main() { char vowels[] = { 'a','e','i','o','u' }; char *pvowels = &vowels; for (int i = 0; i < 5; i++) { printf("%c \n", *(pvowels + i)); printf("%c \n", vowels[i]); } char*temp = (char*)malloc(5 * sizeof(char)); temp[0] = 'a'; temp[1] = 'e'; *(temp + 2) = 'i'; *(temp + 3) = 'o'; temp[4] = 'u'; free(temp); //하지만 변수명은 남음 char **temp1 = (char**)malloc(2 * sizeof(char*)); temp1[0] = (char*)malloc(5 * sizeof(char)); temp1[1] = (char*)malloc(5 * sizeof(char)); temp1[0][0] = 'A'; temp1[0][1] = 'E'; return 0; } 저작자표시 비영리 변경금지 (새창열림)