static void increment(long long *n){ (*n)++; } static void mult2(long long *n){ (*n) = (*n)*2; } struct counter{ long long counter; }; struct counter* cp = malloc(sizeof(struct counter)); cp[0].counter = 5; increment(cp); printf("expecting 6 : %lld.\n", cp[0].counter);
hi, part of code want increment or x2 counter, kept getting error on argument , argument type.
struct count , long long different types.
try
increment(&(cp->counter));
usage of cp[0].counter = 5
instead of cp->counter = 5
quite bizzare, imo.
Comments
Post a Comment