I'm trying to understand the basic of pointers, and done this code:
int c = 3;
int try(int a){
++a;
return 0;
}
int main(){
try(c);
printf("%d\n",c);
return 0;
}
How do I manage to print 4 with pointers? I know that I can do it like this:
int c = 3;
int try(int a){
++a;
return a;
}
int main(){
c = try(c);
printf("%d\n",c);
return 0;
}
but I really want to learn how to pass those values through functions via pointers.
Furthermore, any great book recommendation for solid C learning is always welcome. Thanks in advance.
(&c)try. While it is valid in C, it happens to be a C++ keyword, and can cause confusion.