+ 2
C - Why k doesn't change?
#include <stdio.h> void func(int* x){ x-=5; } int main() { int k = 7; func(&k); printf("%d",k); return 0; }
2 ответов
+ 1
You forgot to dereference the pointer ( *x ) in the function.
Now you're just decrementing the pointer itself.
There are no calls by reference (&) in C, FradeAlencar. :)
0
Ohhh, I read wrong, kkk I thought it was c ++, kkk sorry