Re: [algogeeks] pointer increment problem can anyone tell why this output is coming?
yes thanx a lot . becoz there is no sequence point and there is post increment operator is used . On Sat, Jul 2, 2011 at 10:22 PM, aditya kumar wrote: > though you have put bracket over pointer but it will still be defrenced > first and then the pointer will increemnet to point o next location . its > post increement dats y. > > On Sat, Jul 2, 2011 at 10:17 PM, Deoki Nandan wrote: > >> #include >> >> using namespace std; >> >> int main() >> { >> int intArray[]={1,2,3}; >> int *p=intArray; >> cout<<*(p++); >> return 0; >> } >> >> output : >> >> 1 >> >> >> -- >> **With Regards >> Deoki Nandan Vishwakarma >> >> * >> * >> >> -- >> 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. > -- **With Regards Deoki Nandan Vishwakarma * * -- 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.
Re: [algogeeks] pointer increment problem can anyone tell why this output is coming?
though you have put bracket over pointer but it will still be defrenced first and then the pointer will increemnet to point o next location . its post increement dats y. On Sat, Jul 2, 2011 at 10:17 PM, Deoki Nandan wrote: > #include > > using namespace std; > > int main() > { > int intArray[]={1,2,3}; > int *p=intArray; > cout<<*(p++); > return 0; > } > > output : > > 1 > > > -- > **With Regards > Deoki Nandan Vishwakarma > > * > * > > -- > 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.
Re: [algogeeks] pointer increment problem can anyone tell why this output is coming?
ptr is pointing to array. *(ptr++) will give ptr and *ptr will give 1,further ptr will be incremented and will point to 2. On Sat, Jul 2, 2011 at 10:17 PM, Deoki Nandan wrote: > #include > > using namespace std; > > int main() > { > int intArray[]={1,2,3}; > int *p=intArray; > cout<<*(p++); > return 0; > } > > output : > > 1 > > > -- > **With Regards > Deoki Nandan Vishwakarma > > * > * > > -- > 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. > -- best wishes!! Vaibhav Shukla DU-MCA -- 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.
Re: [algogeeks] pointer increment problem can anyone tell why this output is coming?
p points the base address.The value at p is first passed to the strem and then incremented, On Sat, Jul 2, 2011 at 10:17 PM, Deoki Nandan wrote: > #include > > using namespace std; > > int main() > { > int intArray[]={1,2,3}; > int *p=intArray; > cout<<*(p++); > return 0; > } > > output : > > 1 > > > -- > **With Regards > Deoki Nandan Vishwakarma > > * > * > > -- > 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. > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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.
[algogeeks] pointer increment problem can anyone tell why this output is coming?
#include using namespace std; int main() { int intArray[]={1,2,3}; int *p=intArray; cout<<*(p++); return 0; } output : 1 -- **With Regards Deoki Nandan Vishwakarma * * -- 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.