void function(int a, int b, int c){
char buffer1[5];
char buffer2[10];
int *r;
r = buffer1 + 12;
(*r) += 8;
}
int main(){
int x = 0;
function(1,2,3);
x = 1;
printf("x = %d\n", x);
}

Hi,

I am new to this community and have joined recently. I am trying to run this program and on compiling it gives warning as "assignment from incompatible pointer type". I wanted to know why this happens that is the reason behind this warning?

Also Besides i need to use a debugger such as gdb to find out why the program is outputting the current output of x=1? And how do i provide a memory dump of the stack? Also in my opinion the program should have given output as x=0 but it gave output as x=1? So how do i modify the program so that it gives the output as x=0?

bluesky