Schlemiel the Painter's algorithm: Difference between revisions

Content deleted Content added
mNo edit summary
mNo edit summary
Line 16:
The programming practice that Spolsky used to make his point was repeated concatenation of null-terminated character arrays ("strings").<ref name="basics" />
 
The first step in every implementation of the [[C standard library|standard C library]] function for [[concatenation|concatenating]] strings is determining the length of the string being appended to by checking each character in the array, starting from the beginning, to see if it is the terminating [[Null character|null character]]. In subsequent steps, another string is then copied to the end of the first string, so effectively concatenating the two. At the end of the concatenation, the length of the combined string is discarded upon return to the calling code.
 
In Spolsky's example, the "Schlemiels" occur when multiple strings are being concatenated together: