C - Programming Language
This course covers the basics of programming in C. Work your way through the videos and we'll teach you everything you need to know to start your programming journey!

Building A Mad Libs Game

Lesson 14
Author : Mike Dane
Last Updated : November, 2017


Code

Copy// using fgets() instead of scanf()

char color[50];
char pluralNoun[50];
char celebrity[50];

printf("Enter color: ");
fgets(color, 50, stdin);

printf("Enter plural noun: ");
fgets(pluralNoun, 50, stdin);

printf("Enter celebrity: ");
fgets(celebrity, 50, stdin);

printf("Roses are %s \n", color);
printf("%s are blue \n", pluralNoun);
printf("I love %s \n", celebrity);