Write a program that outputs the string representation of numbers from 1 to n.

But for multiples of three it should output “Fizz” instead of the
number and for the multiples of five output “Buzz”. For numbers which
are multiples of both three and five output “FizzBuzz”.

Example:

n = 15,

Return: [
“1”,
“2”,
“Fizz”,
“4”,
“Buzz”,
“Fizz”,
“7”,
“8”,
“Fizz”,
“Buzz”,
“11”,
“Fizz”,
“13”,
“14”,
“FizzBuzz” ]

/** * Return an array of size *returnSize. * Note: The returned array must be
malloced, assume caller calls free(). */ char** fizzBuzz(int n, int*
returnSize) { *returnSize=n;char buff[10];
//用来存放"Fizz"、"Buzz"、"FizzBuzz"以及1246啥的；长度需大于"FizzBuzz"的长度+1 char **s=(char **)
malloc(n*sizeof(char *));//数组指针 for(int i=1; i<=n; i++) { if(i%15==0)//15的倍数 {
sprintf(buff, "%s", "FizzBuzz");//把"FizzBuzz"存在buff } else if(i%3==0)//3的倍数 {
sprintf(buff, "%s", "Fizz"); } else if(i%5==0)//5的倍数 { sprintf(buff, "%s",
"Buzz"); } else//其他 { sprintf(buff, "%d", i); } *(s+i-1)=malloc(sizeof(buff));
//为s的该位分配需要存放的空间 memcpy(*(s+i-1), buff, strlen(buff)+1);//把buff存放的数据拷贝到s数组
memset(buff, ' ', 11);//把buff清空，方便下次使用 } return s; }

1. sprintf 功能：把格式化的数据写入某个字符串中；
2. void *memcpy(void *dest, const void *src, size_t n);

4. 要注意的就是：1，返回值类型为char** 及char*的 区别。2，指针数组和数组指针的区别。
5. 我目前所理解的是，char**的返回值类型是一个指针数组，而char*的返回值类型是一个数组。
6. 指针数组和数组指针的区别大概是，指针数组是一个数组里的元素都是指针，数组指针是指向数组的指针。