가변 문자열 배열을 반복하는 가장 좋은 방법은 무엇입니까? 예를 들어 내가 좋아하는 것C에서 문자열 조작 배열
struct Book{
char chapter_names[20][50];
int chapters;
...}
int main(){
struct Book Redwall;
strcpy(*chapter_names, "The Wall");
strcpy(*(++chapter_names), "The Grove");
printf("Chapter 1: %s", chapter_names[0]);
printf("Chapter 2: %s", chapter_names[1]);
return 0;
}
이의 출력은 할 수 :
Chapter 1: The Wall
Chapter 2: The Grove
이 코드는
error: lvalue is required as increment operand
이 코드를 컴파일하려고했을 때 어떤 현상이 발생 했습니까? –
질문에 편집 됨 – David
'chapter_names'는 배열입니다. 배열을 증가시킬 수 없습니다 ... –