January 2016
Intermediate to advanced
304 pages
6h 17m
English
Since we've covered generating random strings from a set wordlist, let's look at generating random characters. The char data type is a single, one byte character.
A string is actually just a null-terminated sequence of characters, so the following lines of code produce the exact same result:
Stirng myStringLiteral = "hello";
string myString = { 'h', 'e', 'l', 'l', 'o', '\0' };Likewise, the following code is semantically correct:
char myCharArray[6] = { 'h', 'e', 'l', 'l', 'o', '\0' };
string stringVersion = myCharArray;Since a char is one byte, it has the possible integer representations of 0 to 255. Each of these decimal values represents a different character. A lookup table can found in the ASCII table. For example, ...
Read now
Unlock full access