回复 7楼 AntorDragon
用i控制流程,start控制起点,学习了,谢谢版主问个小问题,scanf_s("%80s", source_str, _countof(source_str)); 这是什么啊,scanf_s,_countof怎么查不到啊
我也模仿着写了一个,怎么无法输出呢,有空的话麻烦指教下,谢谢
#include<stdio.h>
#include<string.h>
const char * turnString(char * target, const * char source, unsigned int start); //const我学您的,不过不是还很明白
void main()
{
char target[80],source[80];
unsigned int i;
puts("putin string");
gets(source);
for(i = 0; i < strlen(source); i++)
{
printf("%s\n", turnString(target,source,i)); //这里咋输出不了呢
}
}
const char * turnString(char * target, const char * source, unsigned int start)
{
unsigned int index = start;
unsigned int i = 0;
while(source[start] != '\0')
target[i++] = source[index++];
index = 0;
while(index < start)
target[i++] = source[index++];
target[i] = '\0';
return target;
}