Schlemiel the Painter's algorithm: Difference between revisions

Content deleted Content added
Wookie2u (talk | contribs)
Wookie2u (talk | contribs)
Line 33:
</source>
 
The ''strcat'' function looks innocious enough, and it is, as long as you don't call it __repeatedly__'''repeatedly''' to build a large string.
 
So lets examine an example of how __not__ to use strcat:
<source lang="c">
// producesbuilds a 1Meg string of "word, word, word, ....";
charvoid *testPerformanceOfStrcat() {
// produces a 1Meg string of "word, word, word, ....";
final int BUFFER_SIZE = 1024*1024;
char word[] = "word";