Posted by: kahgoh on: 21 July, 2008
In C, when you type cast an integer to a character, the character that is assigned is the ASCII character corresponding to that number. This property can be used to generate a set of random of characters, as follows:
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <time.h>
4
5 int main(int argc, char *argv[])
6 {
7 char randChar = ‘ ‘;
8 int counter = 0;
9 [...]