@rajeev
i ran dis code
int main()
{

char str[80];
strcpy(str,"siva");
scanf("%[^india]",str);
printf("%s",str);
return 0;


}
and i got the output as siva...instead of s as expected...can u plz point
out the error

On Tue, Jul 26, 2011 at 11:21 PM, siva viknesh <sivavikne...@gmail.com>wrote:

> @both.......fantastic explanation...thanks :)
>
> On Jul 26, 10:34 pm, rajeev bharshetty <rajeevr...@gmail.com> wrote:
> > So if the input is gujarat it scans gujarat to find the first character
> in
> > gujarat which is also present in india . So the character in gujarat is a
> so
> > it will stop on encountering a and prints the string scanned till then.
> >
> > If the input is india , it matches at first location so it prints the
> > contents of str which is junk.
> >
> > Now consider rajeev it will print r because of a at second position. and
> for
> > siva it will print s try it out.
> >
> > Hope you understood the concept.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Jul 26, 2011 at 10:54 PM, kc Liyan <kcli...@gmail.com> wrote:
> > > if U given input as gujarat........ the scanf will accept inputs as
> > > char's.....but there s an ^ which means ex-or operation should be
> > > performed regular check of existance of any char of {india}...
> > > untill it get's the existance then it will stop the input
> > > getting..........finally it prints as guj
> >
> > > On 7/26/11, siva viknesh <sivavikne...@gmail.com> wrote:
> > > > main()
> > > > {
> >
> > > > char str[80];
> > > > strcpy(str,"junk");
> > > > scanf("%[^india]",str);
> > > > printf("%s",str);
> >
> > > > }
> >
> > > > ...input is gujarat.........output is guj.....plz explain how?
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> Groups
> > > > "Algorithm Geeks" group.
> > > > To post to this group, send email to algogeeks@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > algogeeks+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Algorithm Geeks" group.
> > > To post to this group, send email to algogeeks@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > algogeeks+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > Regards
> > Rajeev N B <http://www.opensourcemania.co.cc>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

9718388816

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to