+ 2
Can anyone explain me the reason why this code does not work?
#include <stdio.h> int main () { int str; printf("Enter your message:\n"); scanf("%s",&str); printf("message:\t",str); return 0; }
3 ответов
+ 2
Got it. So is this right?
_____________________
#include <stdio.h>
int main ()
{
int str;
printf("Enter your message:\n");
scanf("%d",&str);
printf("message:%d\t",str);
return 0;
}
+ 2
its
%s", str) not %d
+ 1
For a string
___________
#include <stdio.h>
int main ()
{
string str;
printf("Enter your message :\n") ;
scanf("%s",&str) ;
printf("message:%s\t" str) ;
return 0;
}