#include<stdlib.h>;
#include<stdio.h>;
#include<string.h>;
#pragma warning (disable:4996);
void*my_str1(char*p)
{
while (*p = '\0')
{
char*q = p;
if (*(p) = 0)
{
while (*q = 0)
{
*q = *(q + 1);
q++;
}
}
p++;
}
printf("%s\n", p);
return;
}
int main()
{
char p[128] = "\0ndlandfa\0ndlanfa\0\0dn\0alfnla\0\0";
my_str1(p);
printf("%s\n", p);
system("pause");
return 0;
}
char p[128] = "\0ndlandfa\0ndlanfa\0\0dn\0alfnla\0\0";要求把\0全部移到最后面
while (*p = '\0')改成 while (*p == '\0')
if (*(p) = 0)
{
while (*q = 0)
全是一个问题,判断条件用==,不是=
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632