#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char * odd(const char * S, char * dest);
int main()
{
char * source = "abcdefghijklmnopacegiacegi";
unsigned int length = strlen(source);
char dest[length];
printf("%s\n",odd(source, dest));
}
char * odd(const char * source, char * dest)
{
int count = 0;
unsigned int length = strlen(source);
for(int i = 0; i < length; i++)
{
if((source[i] %2)!= 0)
{
dest[count] = source[i];
count++;
}
}
return dest;
}
的DEST增加的大小和源這個字符串的長度是如何增加的?
* sma額*謝謝 –