Original Post
I'm writing a code to copy a source buffer to a destination buffer. Initially i use a nested loop to copy the buffer by individually assigning every element into the destination buffer. I figure out that memcpy might be more efficient and faster but I am not sure, which method is better? If I use memcpy, I'll memcpy row by row. Code: for ( Row = Y; s_Y < nRows; ++Row, ++s_Y ) { for ( Col = X, s_X = 0; s_X < nCols; ++Col, ++s_X ) { Dest[Row][Col].Attributes = Source[s_Y][s_X].Attributes; Dest[Row][Col].Char.AsciiChar = Source[s_Y][s_X].Char.AsciiChar; } } // Better method? More efficient? for ( Row = Y, s_Y = 0; s_Y < nRows; ++Row, ++s_Y ) memcpy( &Dest[Row][X], Source[s_Y], nCols * sizeof( CHAR_INFO ) );