C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

scanf behaviour

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C Language (Moderated)
View previous topic :: View next topic  
Author Message
azhar084@gmail.com
Guest





PostPosted: Thu May 17, 2007 9:11 am    Post subject: scanf behaviour Reply with quote



I am new to C. I was trying to read input from key board using
scanf,
here's my program


int main(void)
{


int i,j;


scanf("hai");
scanf("%d\n",&i);
printf("i value %d\n",i);
scanf("%dabc",&j);
printf("j value %d\n",j);


return 0;



}


its printing i and j values both at a time(desired should print i
value first and j next).
I am using gcc 4.2 on linux .
what does scanf("hai") mean?
what happens if i give
scanf("%dabc",&j); ?

thanks in advance.
--
comp.lang.c.moderated - moderation address: clcm (AT) plethora (DOT) net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.