Re: [algogeeks] explain the putput of this program

2011-09-04 Thread bharatkumar bagana
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
ankitsablok19091...@gmail.comwrote:

 #includeiostream
 #includecstdio
 #includecctype
 #includecstdlib
 #includecstring

 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 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
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*
bagana.bharatku...@gmail.com

-- 
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] explain the putput of this program

2011-09-03 Thread Ankit Sablok
#includeiostream
#includecstdio
#includecctype
#includecstdlib
#includecstring

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 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.