c: when using a pointer as input in a function incrementing the pointers value by using *pointer++ doesn't work
问题 While I was learning C (I am very new to it), I was playing around with pointers. Here you can see my code: #include <stdio.h> void change(int *i) { *i += 1; } int main() { int num = 3; printf("%d\n", num); change(&num); printf("%d\n", num); return 0; } My aim was to replace incrementing the num value without reassigning it like so: num = change(num); That's why I was passing the memory location of num using the & : so it could be used as a pointer. Before this version everything in the code