We have a function like this:
Code:
void DS_append(DynString ds, char *newtxt)
And we need to ask the user for an integer input and then append it. So I have:
Code:
int x;
printf("Please enter a number: ");
scanf("%d", &x);
DS_append(ds, x); // This is line 29
But when I compile it gives me:
Code:
ex5.c:29: warning: passing argument 2 of ‘DS_append’ makes pointer from integer without a cast
And when I run it, of course, the much dreaded...
I've tried every combination of
DS_append(ds, &x);
DS_append(ds, (char) x);
DS_append(ds, (char *) x);
DS_append(ds, (char *) &x);
But none seem to work.
Can anyone figure out what I'm doing wrong here?