close
string.h 的函數 memset() 將某一記憶體區段的前 n 個字元全部設定為某一字元。
#include <stdio.h>
#include <string.h>
int
main(
void
)
{
char
s[] =
"congratulation"
;
printf
(
"%s\n"
,
memset
(s,
'n'
, 13));
return
0;
}
結果為輸出
nnnnnnnnnnnnn
http://pydoing.blogspot.com/2010/07/c-memset.html
全站熱搜