I am new to c++ . I was trying to write following code to fill up each byte of array with new values without overriding others. Each byte (r) below should be added up at new address of the array.
int _tmain(int argc, _TCHAR* argv[]) {
char y[80];
for(int b = 0; b < 10; ++b) {
strcpy_s(y, "r");
}
}
Please let me know if there is any function in c++ which can do that. In the above case the value ‘r’ is arbitrary and this can have any new value.
So the resultant array of characters should contain value rrrrr… 10 times.
Thanks a lot in advance for this.
Using C++11
Or, as mentioned in the comments you can use
std::fill(array,array+10,'r').