char arr_del(char* p, int pos)
{if (pos>= strlen(p) || pos<0){printf("这是一个无效下标\n");exit(1);}//到这里就是有效下标char ch = p[pos];//把要删除的下标存储for (int i = pos; p[i] != '\0'; i++){p[i] = p[i + 1];}return ch;
}
int main()
{char arr[100];int pos = 0;printf("请输入你的字符串\n");fgets(arr, sizeof(arr), stdin);printf("你输入的字符串为%s", arr);printf("请输入你要删除的字符下标数\n");scanf("%d", &pos);char ch = arr_del(arr, pos);printf("删除后的字符串为%s,删除的字符下标对应的字符为%c", arr, ch);return 0;
}