D:\code\samplecode\main.cpp|5|error: initializer-string for array of chars is too long|
I get this error on gcc (Mingw) . Though the array indexing starts from 0. The length specified in char str[7] is always straightforward . in this case char str[7] . the length of str is seven not eight ;hence the error -- ram From: [email protected] [mailto:[email protected]] On Behalf Of sharad kumar Sent: 13 June 2010 07:59 To: [email protected] Subject: Re: [algogeeks] c array hey array indexing starts from 0 rite?? then y shld u get overflow in first place...... s t r i n g s \0 0 1 2 3 4 5 6 7 On Sat, Jun 12, 2010 at 9:14 PM, divya <[email protected]> wrote: #include<stdio.h> int main() { char str[7]="strings"; printf("%s\n",str); return 0; } here i m nt getting overflow error whereas if i write stringss instead of strings then there is overflow error.. isnt null stored after s in strings nd 1st case shd also give overflow??? -- 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] <mailto:algogeeks%[email protected]> . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- yezhu malai vaasa venkataramana Govinda Govinda -- 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.
