I, as student, have been assigned to finish this task, pointer in C. I state the problem and question after the codes. The codes are:
#include <stdio.h>
#include <stdlib.h>
int *value(void){
int i = 3;
return &i;
}
void callme(void) {
int x = 35;
}
int main(void){
int *ip;
ip = value();
printf("*ip == %d\n", *ip);
callme();
printf("*ip == %d\n", *ip);
}
I tried the codes using Code Blocks software. The problem is, when I build and run (The feature in "Code Block" software to just run through the program without any requirement other than the codes itself) the program, it only shows the execution time, while i need is the value of ip according to the question below. I am still beginner, so bear with me. :-)
The question is "What is the value of ip and explain what happens to ip after each functions have been called?" If able, please answer and explain clearly. If there is anything wrong or not clear, please let me know and comment. Thanks a lot for the help.