mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-05-06 11:46:09 +08:00
42 lines
855 B
HTML
42 lines
855 B
HTML
<h1>字符串函数 - bzero</h1>
|
|
|
|
|
|
<p>原型:extern void bzero(void *s, int n);</p>
|
|
|
|
<p>用法:#include <string.h></p>
|
|
|
|
<p>功能:置字节字符串s的前n个字节为零。</p>
|
|
|
|
<p>说明:bzero无返回值。</p>
|
|
|
|
举例:<pre><code class="language-c">
|
|
|
|
// bzero.c
|
|
|
|
#include <syslib.h>
|
|
#include <string.h>
|
|
|
|
main()
|
|
{
|
|
struct
|
|
{
|
|
int a;
|
|
char s[5];
|
|
float f;
|
|
} tt;
|
|
|
|
char s[20];
|
|
|
|
bzero(&tt,sizeof(tt)); // struct initialization to zero
|
|
bzero(s,20);
|
|
|
|
clrscr();
|
|
printf("Initail Success");
|
|
|
|
getchar();
|
|
return 0;
|
|
}
|
|
|
|
</code></pre>相关函数:<a href="bcmp.html">bcmp</a>,<a href="bcopy.html">bcopy</a>
|
|
|