강의

멘토링

커뮤니티

Inflearn Community Q&A

as209406770697's profile image
as209406770697

asked

C Programming - From Introduction to Game Development

scanf

실행은 잘되는데 글이 이상하게 출력이 되요 ㅠㅠ

Written on

·

249

0

실행은 잘되는데 글이 이상하게 출력이 되요 ㅠㅠ

#include <stdio.h>
int main(void)
 {       char str[256];
	scanf_s("&s", str, sizeof(str));
	printf("%s\n", str);
       return 0;
}
c

Answer 1

0

전 다음과 같이 이해했습니다!

#include <stdio.h>

int main(void)

{

char str[256];

printf("what"); //what은 원하는 질문 내용 입력

scanf_s("%s", str, sizeof(str)); // 답변 입력 시 입력한 답변=str로 정의

printf("%s", str); // 따라서 str출력시 입력한 답변이 출력

return 0;

}

as209406770697's profile image
as209406770697

asked

Ask a question