[ create a new paste ] login | about

Link: http://codepad.org/6hamacpH    [ raw code | output | fork ]

C, pasted on Jun 18:
#include <stdio.h>
#include <string.h>

int main()
{
char ary[5][8];
	char temp[8];
	int i;

	char **a_ptr = &ary;

		for(i=0; i<5; i++){
			sprintf(temp, "0x10%d" , i);
			strcpy(ary[i] , temp);
			printf("\n-%s@%p == %p" , ary[i] , &ary[i] , (a_ptr + i));

		}

		for(i=0; i<5; i++){
			printf("\n+%s@%p" , (a_ptr + i) ,  (a_ptr + i));

		}
		puts("");

return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
11

-0x100@0xbf8602f4 == 0xbf8602f4
-0x101@0xbf8602fc == 0xbf8602f8
-0x102@0xbf860304 == 0xbf8602fc
-0x103@0xbf86030c == 0xbf860300
-0x104@0xbf860314 == 0xbf860304
+0x100@0xbf8602f4
+0@0xbf8602f8
+0x101@0xbf8602fc
+1@0xbf860300
+0x102@0xbf860304


Create a new paste based on this one


Comments: