你看得出来哪错了么?

时间:2022-03-03 12:47:44
#include <stdio.h>
void copy_string(char*, char*);
int main(void)
{
	char *a = "I am a teacher.";
	char *b = "You are a student.";
	printf("string_a = %s\nstring_b = %s\n", a, b);
	copy_string(a, b);
	printf("string_a = %s\nstring_b = %s\n", a, b);
	return 0;
}
void copy_string(char *from, char *to)
{
	for (; *from != '\0'; ++from, ++to)
	{
		*to = *from;
	}
	*to = '\0';
}

gcc下:

你看得出来哪错了么?

codeblocks下:

你看得出来哪错了么?

你看得出来哪错了么?

        现在,你该懂了吧!