but what input did u give??
if u r giving i/p as siva o/p will be s only
On Wed, Jul 27, 2011 at 1:24 AM, aditi garg <[email protected]>wrote:
> @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 <[email protected]>wrote:
>
>> @both.......fantastic explanation...thanks :)
>>
>> On Jul 26, 10:34 pm, rajeev bharshetty <[email protected]> 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 <[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.
>>
>>
>
>
> --
> 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 [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,
Kamakshi
[email protected]
--
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.