C++ examples for Data Type:char array
Using memset to copy the byte into a specified number of bytes
#include <iostream> #include <cstring> // memset prototype using namespace std; int main() //from w w w . j a va 2 s .c om { char string1[ 15 ] = "BBBBBBBBBBBBBB"; cout << "string1 = " << string1 << endl; cout << "string1 after memset = " << static_cast< char * >( memset( string1, 'b', 7 ) ) << endl; }