output 1 because it is pointing to first position of the array.. 5 is because (*h)++; --- here it is adding sizeof(int) to 1....... if u make h as short type , then it will add 2 to 1.. i don't know why exactly ..........
On Sat, Sep 3, 2011 at 2:36 PM, Ankit Sablok <[email protected]>wrote: > #include<iostream> > #include<cstdio> > #include<cctype> > #include<cstdlib> > #include<cstring> > > using namespace std; > > int main() > { > int **h; > int a[2][2]={1,2,3,4}; > h= (int **)a; > int i,j; > printf("\n%d",*h); > (*h)++; > printf("\n%d",*h); > getchar(); > getchar(); > > return 0; > } > > gives an output 1 and 5 why? > > -- > 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 *BharatKumar Bagana* **http://www.google.com/profiles/bagana.bharatkumar<http://www.google.com/profiles/bagana.bharatkumar> * Mobile +91 8056127652* <[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.
