Originally Posted by
everyone0
this is killing me can't find a single problem with the function and still gives me same error
I suggest that you try:
Code:
#include <stdio.h>
#include <string.h>
void delete(char x[], int size, int k)
{
int i;
for (i = k; i <= strlen(x); i++)
x[i] = x[i + 1];
strcpy(&x[k], &x[k + 1]);
}
int main(void)
{
char S1[10];
int k;
scanf("%s%d", S1, &k);
delete(S1, 10, k);
return 0;
}
If you still have a compiler error, then try:
Code:
#include <stdio.h>
#include <string.h>
void remove(char x[], int size, int k)
{
int i;
for (i = k; i <= strlen(x); i++)
x[i] = x[i + 1];
strcpy(&x[k], &x[k + 1]);
}
int main(void)
{
char S1[10];
int k;
scanf("%s%d", S1, &k);
remove(S1, 10, k);
return 0;
}
If the error disappears, then I would guess that anduril462's suspicion is confirmed: you are compiling as C++ instead of C. If the error remains, then you either need to figure out how to fix your compiler, or you ditch your compiler.