From the course: Secure Coding in C

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Challenge: The secret code

Challenge: The secret code - C Tutorial

From the course: Secure Coding in C

Challenge: The secret code

(upbeat music) - [Instructor] Your challenge is to update a user's secret code. Do so in the following steps. Prompt the user to input their secret code. Then confirm that the input is valid. For example, using the fgets function, which I recommend, check for null input, and remove the new line. Test to verify that the code input is exactly five characters long. Once you have valid input, create a new code by appending the word "new" to the existing string, output the updated string showing it to the user, and always practice. During the entire process, practice your safe coding with strings for all of these steps. This challenge should take you about 15 minutes to complete.

Contents