Very nice C code to generate a random string. And some other useful info.

This code generates a random string when run, this could be quite useful. Print some very useful Linux system information using C. These two C programming samples should be quite useful to any programmer on Linux. Print a random fortune from an array. This program prints a random fortune from an array. This is a … Read more

Return the length of a string easily in C.

This simple code will return the length of a string easily. #include <stdio.h> #include <stdlib.h>   int main (void) { char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int len_str;   // calculates length of string len_str = sizeof(base64) / sizeof(base64[0]); printf("%d\n", len_str); return 0; }#include <stdio.h> #include <stdlib.h> int main (void) { char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int len_str; … Read more

C code that will select a random word from an array and include it in a string.

This code will pick a random word from the x[] array and include it in the printed string. This program will also get your current Linux username to customize the output. I am sure this code would be very useful to someone who wants to know how to handle arrays in C. #include <stdio.h> #include … Read more