@sunny it should have printed some garbage after 'charlie' in that case ?
that is what happens with scanf when you overwrite '\0'... isn't it ?

On Sun, Jul 24, 2011 at 12:25 PM, sunny agrawal <[email protected]>wrote:

> char five[7] -> string of length 7
> charlie -> 7 length string
>
> declare it as char[8] u will get expected output
>
> On Sun, Jul 24, 2011 at 12:15 PM, Anurag atri <[email protected]>wrote:
>
>> yup , on ideone it indeed is giving the output you suggested ..
>>
>>
>>
>> On Sun, Jul 24, 2011 at 12:10 PM, [email protected] <
>> [email protected]> wrote:
>>
>>> @Anrag: i am using gcc on Ubuntu.I also checkd it on Ideone online
>>> compiler.
>>>
>>>
>>> But Declare the character strings
>>> char five[7];
>>> char four[7];
>>> int three;
>>> char two[7];
>>> char one[7];
>>>
>>> int his order and we get the correct output. But i dont know y?Its
>>> something to do with Memory location where the strings are defined.
>>>
>>>
>>>
>>> *Muthuraj R.
>>> 4TH Year BE.**
>>> Information Science Dept*
>>> *PESIT, Bengaluru .
>>> *
>>>
>>>
>>>
>>>
>>> On Sat, Jul 23, 2011 at 11:34 PM, Anurag atri 
>>> <[email protected]>wrote:
>>>
>>>> Dev c++ , which one are you using ?
>>>>
>>>> On Sun, Jul 24, 2011 at 12:01 PM, [email protected] <
>>>> [email protected]> wrote:
>>>>
>>>>> No. Its not coming like dat.
>>>>>
>>>>>
>>>>>
>>>>> This is 10 times charlie
>>>>>  Thisis10charlie
>>>>>
>>>>>
>>>>> This is the output
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *Muthuraj R.
>>>>> 4TH Year BE.**
>>>>> Information Science Dept*
>>>>> *PESIT, Bengaluru .
>>>>> *
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sat, Jul 23, 2011 at 11:23 PM, shady <[email protected]> wrote:
>>>>>
>>>>>> it is not coming like that ?
>>>>>>
>>>>>>
>>>>>> On Sun, Jul 24, 2011 at 11:41 AM, Anurag atri <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> The output will be
>>>>>>> This is 10 times charlie
>>>>>>> Thisis10timescharlie
>>>>>>>
>>>>>>> and it makes sense , this will be helpful
>>>>>>> http://www.cplusplus.com/reference/clibrary/cstdio/sscanf/
>>>>>>>
>>>>>>> Regards
>>>>>>> Anurag Atri
>>>>>>>
>>>>>>> --
>>>>>>> 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.
>>>>>>
>>>>>
>>>>>  --
>>>>> 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
>>>> Anurag Atri
>>>> III year
>>>> Computer Engineering
>>>> Delhi College Of Engineering
>>>>
>>>>
>>>>  --
>>>> 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
>> Anurag Atri
>> III year
>> Computer Engineering
>> Delhi College Of Engineering
>>
>>  --
>> 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.
>>
>
>
>
> --
> Sunny Aggrawal
> B-Tech IV year,CSI
> Indian Institute Of Technology,Roorkee
>
>
>  --
> 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.

Reply via email to