I'm stuck understanding a problem i have and i would appreciate your help. I'm very new to C so please bear with me.
I have the following code:
#include <stdlib.h>
#include <stdio.h>
int h(int value){
if (value % 2 == 0){
// (***)
printf("Even");}
return 0;
}
void g(double value){
int i;
for(i=1; i<value; i++){
printf("%d", i);
}
h(value);
}
int f(int value){
static int sum;
sum += value;
printf("%d", sum + value);
g(sum);
return 0;
}
int main(){
int *p,
double *q;
p = (int *)malloc(10*sizeof(int));
q = (double *)malloc(10*sizeof(double));
f(1);
f(2);
f(3);
}
and i know how to find the output but now i'm being asked to draw how the memory looks at the place (***)
in function h()
. suppose that the stack starts at the address 100 and the length of return address is 4 bytes . i need to write on the stack the length of each cell containing a memory.
Can anyone teach me how to do this?