I have this:
typedef struct {
int value;
} Thing;
void doSomething(Thing *ptr) {
ptr = (Thing *)calloc(5, sizeof(Thing));
int i;
for(i = 0; i < 5; i++) {
scanf("%d", (ptr[i]).value);
}
}
int main() {
Thing t;
doSomething(&t);
}
Which crashes at the scanf() line. How should I be writing it instead?