Graham wants to see and clearify

Hello, my name is Graham, i am working for Akamaitechnologies,
I want to know why my program prints only "wanna", i want it to print wanna see
char g[50]="wanna see";
printf("Enter:");
scanf("%s", g);
print("%s",g);
thanks
[256 byte] By [Akamai] at [2007-11-19 22:48:42]
# 1 Re: Graham wants to see and clearify
Did you see what's are you trying to do in your Program in your Code if you Only Print g you will get full value but you are taking input from your screen and you are taking input as a string so that's why you are getting wanna in your program only if you remove scanf in your Program it will Print wann see .otherwise if you take Input from console you should remember a string terminate at space or new line.



char g[50]="wanna see"; // here you Initialize your char array
printf("Enter:");
scanf("%s", g); // if you remove this line you will get wann see as a
output of your printf but when you are going to take input from scanf
so string terminate at space and upto space you can see your all data
as a output of printf
print("%s",g); // it should be printf not print


Thanx
humptydumpty at 2007-11-9 1:04:13 >
# 2 Re: Graham wants to see and clearify
That's truly an excelent explanation, I just thought doing like what i did would benefit for compiling speed, fastest of all
I hope after I do as what you told me to my program will get through easier
Thanks ;)
Akamai at 2007-11-9 1:05:10 >
# 3 Re: Graham wants to see and clearify
you welcome dude. go ahead
humptydumpty at 2007-11-9 1:06:09 >
# 4 Re: Graham wants to see and clearify
Ah, so nothing to do with me, then. Good explanation humptydumpty.
Graham at 2007-11-9 1:07:11 >
# 5 Re: Graham wants to see and clearify
Thanx Graham.
humptydumpty at 2007-11-9 1:08:10 >