15 lines
391 B
C++
15 lines
391 B
C++
#include <memory.h> //我试了一下,C语言这么用,C++还可以用<cstring>
|
||
#include <stdio.h>
|
||
|
||
int main( void )
|
||
{
|
||
char buffer[] = "This is a test of the memset function";
|
||
printf( "Before: %s\n", buffer );
|
||
|
||
memset( buffer, '*', 4 );
|
||
printf( "After: %s\n", buffer );
|
||
|
||
memset( buffer, '*', sizeof(buffer) );
|
||
printf( "After: %s\n", buffer );
|
||
return 0;
|
||
}
|