what will be the output fr this??
printf("ab\c");
On Tue, Jul 26, 2011 at 6:22 PM, swetha rahul <[email protected]>wrote:
> Dipankar, Thanks!!!
>
>
> On Tue, Jul 26, 2011 at 8:44 AM, Dipankar Patro <[email protected]>wrote:
>
>>
>> Swetha,
>>
>> '\' in C is used to denote a escape sequence in C strings (and also in
>> many other languages).
>> e.g '\n' is for New Line '\n' is counted as one character.
>> Now '\ooo' is for an ASCII in octal representation.
>> here is the list of all escape sequences:
>> http://msdn.microsoft.com/en-us/library/h21280bw(v=vs.80).aspx
>>
>> So for your string : "\12345s\n"
>> here '\123' is an ASCII in octal, hence one character.
>> rest you know about the characters: so length = '\123'(1) + 3 + '\n'(1) =
>> 5.
>>
>> I suggest you try with other combinations with '\' and print the output.
>> They will definitely show some weird stuffs :)
>>
>> Hope that helps.
>> On 25 July 2011 22:53, swetha rahul <[email protected]> wrote:
>>
>>> char *s="\12345s\n";
>>> printf("\n %d",strlen(s));
>>>
>>> The output is 5...?? But 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.
>>>
>>
>>
>>
>> --
>>
>> ___________________________________________________________________________________________________________
>>
>> Please do not print this e-mail until urgent requirement. Go Green!!
>> Save Papers <=> Save Trees
>>
>> --
>> 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.
>
--
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.