문자열 암호화 질문 개파 submission.c: In function ‘main’: submission.c:4:2: error: initialization makes integer from pointer without a cast char W[100]={NULL}; ^ submission.c:4:2: error: (near initialization for ‘W[0]’) submission.c:13:17: error: comparison between pointer and integer while( W[i*2] != NULL ){ ^ submission.c:18:19: error: comparison between pointer and integer while( W[i*2+1] != NULL ){ ^ submission.c:7:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ submission.c:10:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", W); ^ ~~~ c++ #include <stdio.h> int main(){ char W[100]={NULL}; int i, n; scanf("%d", &n); while(n){ scanf("%s", W); i=0; while( W[i*2] != NULL ){ printf("%c", W[i*2]); i++; } i=0; while( W[i*2+1] != NULL ){ printf("%c", W[i*2+1]); i++; } printf("\n"); n--; } return 0; } 10년 전
1개의 댓글이 있습니다. JongMan NULL 대신에 '\0'을 쓰세요. 10년 전 link 정회원 권한이 있어야 커멘트를 다실 수 있습니다. 정회원이 되시려면 온라인 저지에서 5문제 이상을 푸시고, 가입 후 7일 이상이 지나셔야 합니다. 현재 문제를 푸셨습니다.
개파
10년 전