1/10 c언어 문자열 깊게 다루기
C
#include <stdio.h>
int main() {
char c_array[7] = {'c','o','d','i','n','g','\0'};
printf("%s\n", c_array);
// \0 널문자를 생각해서 원래 크기보다 1씩 더 크게 설정한다
for(int i=0;i<7;i++){
printf("%c\n", c_array[i]);
}
//아스키코드
for(int i=0;i<7;i++){
printf("%d\n", c_array[i]);
}
printf("%d\n", '1');
//문자열 입력받기
char name[64];
scanf("%s", name);
printf("%s", name);
}
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.