Created
October 3, 2018 01:03
-
-
Save john302/66d8f7a221b0535aed798e3f80d4801b to your computer and use it in GitHub Desktop.
Program to print a random string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
int main (void) { | |
srand((unsigned int)(time(NULL))); | |
int index = 0; | |
char char1[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/,.-+=~`<>:"; | |
for(index = 0; index < 48; index++) | |
{ | |
printf("%c", char1[rand() % (sizeof char1 - 1)]); | |
} | |
puts(""); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment