Yes compiler always ignores the first '\' and if it finds a recognizable character after this escape sequence . it will interpret it. Otherwise it just dumps it according to predefined semantics of machine code generation.But I would suggest everyone in this group to try out http://www.codepad.org Where you can easily test the code in any language of your choice. It must be using gcc compiler. Thanks
On Tue, Jul 26, 2011 at 10:27 PM, aditi garg <aditi.garg.6...@gmail.com>wrote: > ya thats wat my doubt was...if its not a recognised escape sequence thn how > is it interpreted?? > Would the compiler jst ignore ''\''? > > > On Tue, Jul 26, 2011 at 10:25 PM, Ram CEG <honest...@gmail.com> wrote: > >> op:abc.. \c is not an escape sequence >> >> >> On Tue, Jul 26, 2011 at 10:17 PM, aditi garg >> <aditi.garg.6...@gmail.com>wrote: >> >>> what will be the output fr this?? >>> printf("ab\c"); >>> >>> >>> On Tue, Jul 26, 2011 at 6:22 PM, swetha rahul >>> <swetharahu...@gmail.com>wrote: >>> >>>> Dipankar, Thanks!!! >>>> >>>> >>>> On Tue, Jul 26, 2011 at 8:44 AM, Dipankar Patro <dip10c...@gmail.com>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 <swetharahu...@gmail.com> 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 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. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> ___________________________________________________________________________________________________________ >>>>> >>>>> 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 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. >>>> >>> >>> >>> >>> -- >>> 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. >>> >> >> -- >> 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. > -- 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.