Intermediate · 25 minYou are hereRead
Strings in C
A C string is an array of chars ending in a zero byte. Every string function walks until it finds that zero, so a buffer too small for a copy goes wrong without a word.
Arrays and strings
Intermediate · 25 minYou are hereRead
A C string is an array of chars ending in a zero byte. Every string function walks until it finds that zero, so a buffer too small for a copy goes wrong without a word.
Intermediate · 20 minYou are hereRead
Most string tasks are a walk with one or two pointers. Letters are numbers, so changing case is a subtraction, and reversing or testing a palindrome needs no second array.
Intermediate · 20 minYou are hereRead
A table of 26 counts, or the 26 bits of one integer, records which letters have been seen, so repeats and anagrams are found in one pass over the string.
Intermediate · 25 minYou are hereRead
Every ordering of a string comes from fixing each letter in the first place in turn and ordering the rest the same way, swapping back after each try.
Related topics