azhar084@gmail.com Guest
|
Posted: Thu May 17, 2007 9:11 am Post subject: scanf behaviour |
|
|
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. |
|