Here is the program (follow comments plz ):
Code:
//int i and int *(_4zz+1) has the same address??
//if i remove either int a or int b i get an error and program crashes
//if i use the int i variable it affects the int *(_4zz+1) pointer
//anyone know what is wrong? plz help me :)
//post here or PM ME: [email protected]
#include <stdio.h>
int g50v3Rz(int *_4zz);
int main(){
/*int a and int b defined here.. dont know why, but i cant remove them
and suspect it has with the memory address of "i" to do with... :(*/
int a,b,i,q = 0,*_4zz = &q;
for(i=0;i<5;i++)*(_4zz+i) = i;
for(i=0;i<5;i++)printf("%d\n",*(_4zz+i));
g50v3Rz(_4zz);
printf("\nMain\n\n");
//cant loop using *(_4zz+i) cause if i use i, i get wrong results
//weird bug or something i did wrong i dont know :(
printf("%d\n%d\n%d\n%d\n%d\n",*(_4zz),*(_4zz+1),*(_4zz+2),*(_4zz+3),*(_4zz+4));
//here i confirm that int i and *(_4zz+1) has the same address -or so i think
printf("\n%x %x %x\n",*(_4zz+4),*(_4zz+1),i);
printf("\n%d\n%d\n%d\n%d\n%d\n",*(_4zz),*(_4zz+1),*(_4zz+2),*(_4zz+3),*(_4zz+4));
return 0;}
int g50v3Rz(int *_4zz){
int x;
printf("\ng50v3Rz\n\n");
for(x=0;x<5;x++)printf("%d\n",*(_4zz+x));
*_4zz = 110;
//here is int *(_4zz+1) used
*(_4zz+1) = 221;
*(_4zz+2) = 332;
*(_4zz+3) = 443;
*(_4zz+4) = 554;
printf("\n");for(x=0;x<5;x++)printf("%d\n",*(_4zz+x));}