Hi all,
Can you confirm im passing my pointer to and from the function correctly? In some examples I have seen them pass the address - I have also passed address?
Lastly I have read the only math you can perform on a pointer is ++ and --. After thinking about this, I think the mean you can only perform these operations on the address but not the pointer?
I have included my pointer example below for your review.
Code:#include<stdio.h> char add_number(char *ptr) { *ptr = *ptr + 10; return *ptr; } int main() { char result; char name = 2; char *ptr; ptr = &name; result = add_number(ptr); printf("%d\n", result); }