So I'm trying to create a program that takes user input and puts it into a short story, mad libs style. I've also made arrays containing specific elements within the story (the item the characters stole, the name of the enemy, who dies at the end, etc) so that the story is different every time; I need to pull the strings randomly from each array into their place in a printf statement, I know I need to use rand() and srand() but I'm not sure exactly how to use them here.
example of what I have:
char strNames[6][10]={"Eric", "Stan", "Kyle", "Kenny", "Randy", "Craig"};
(rand()%6) +1;
printf("\n\t %s", strNames[iRandName]);
printf(" and his best friend, %s year old %s", cAge, cName);
it's running fine, but obviously since I don't have a complete rand() it's just pulling the first string from the array every time.
*Bonus points if you can tell me how to keep the randomly called string constant for that array, throughout the program; say I use strNames again a few sentences later it should still print the string it called the first time, not a new random one.
Long question i know, thanks in advance.