thanks sameer. On Wed, Jun 29, 2011 at 10:19 AM, [email protected] < [email protected]> wrote:
> We are getting same output because in this problem we wre typecastin > unsigned integer to a signed integer...Hence normal operation results. > > On 6/28/11, Kamakshii Aggarwal <[email protected]> wrote: > > #include<stdio.h> > > > > int main() > > { > > > > int array[] = {23,34,12,17,204,99,16}; > > int TOTAL_ELEMENTS =(sizeof(array) / sizeof(array[0])); > > int d; > > for(d=-1;d <= (TOTAL_ELEMENTS-2);d++) > > printf("%d\n",array[d+1]); > > return 0; > > } > > > > but in this case we are getting the same o/p..can u please again explain > > whats wrong with the above question. > > > > On Sat, Jun 25, 2011 at 9:24 PM, nicks <[email protected]> > wrote: > > > >> that's grt...i didn't knew it !! > >> > >> > >> On Sat, Jun 25, 2011 at 4:43 AM, Anantha Krishnan < > >> [email protected]> wrote: > >> > >>> Good. > >>> > >>> > >>> On Sat, Jun 25, 2011 at 4:47 PM, RITESH SRIVASTAV < > >>> [email protected]> wrote: > >>> > >>>> sizeof returns size_t values and size_t is "typedef unsigned int > >>>> size_t;" > >>>> but when you compare it with -1(int) ,d=-1 is converted to unsigned > >>>> int > >>>> which becomes very large (INT_MAX) > >>>> and d (INT_MAX) > 7 so the loop is never executed. > >>>> > >>>> On Jun 25, 3:23 pm, harshit pahuja <[email protected]> wrote: > >>>> > #include<stdio.h> > >>>> > #define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0])) > >>>> > int array[] = {23,34,12,17,204,99,16}; > >>>> > int main() > >>>> > { > >>>> > int d; > >>>> > for(d=-1;d <= (TOTAL_ELEMENTS-2);d++) > >>>> > printf("%d\n",array[d+1]); > >>>> > return 0; > >>>> > > >>>> > } > >>>> > > >>>> > y der is nothing in the output ????..... > >>>> > > >>>> > - > >>>> > Regards - > >>>> > HARSHIT PAHUJA > >>>> > >>>> -- > >>>> 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, > > 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. > > > > > > -- > 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.
