当前位置

首页 > 商务英语 > 计算机英语 > c语言gets的用法

c语言gets的用法

推荐人: 来源: 阅读: 2.39W 次

C语言中缓冲区就是内存中开辟的一块存储空间。数组也是一个缓冲区。或者你用内存操作函数自己去开辟一块内存空间也是缓冲区。下面我们来看看c语言gets的用法。

ing-bottom: 100%;">c语言gets的用法

例:

void test7()

{

char str1[80];

char str2[80];

printf("please input aany 2 sentence:n");

gets(str1);

scanf("%s",str2);

printf("string1 is:%sn",str1);

printf("string2 is:%s",str2);

}

int _tmain(int argc, _TCHAR* argv[])

{

test7();

return 0;

}

输入:hello world

hello world

执行结果为:string1 is:hello world

string2 is :hello