We have a function like this:
And we need to ask the user for an integer input and then append it. So I have:Code:void DS_append(DynString ds, char *newtxt)
But when I compile it gives me:Code:int x; printf("Please enter a number: "); scanf("%d", &x); DS_append(ds, x); // This is line 29
And when I run it, of course, the much dreaded...Code:ex5.c:29: warning: passing argument 2 of ‘DS_append’ makes pointer from integer without a cast
I've tried every combination ofCode:Segmentation fault
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?



LinkBack URL
About LinkBacks



