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 <[email protected]> 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 <[email protected]> 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 [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to