close

string.h 的函數 memset() 將某一記憶體區段的前 n 個字元全部設定為某一字元。

 

#include <stdio.h>
#include &ltstring.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
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 pabeni 的頭像
    pabeni

    pabeni的部落格

    pabeni 發表在 痞客邦 留言(0) 人氣()