Lets say I have the code below. This program example would ask the user to enter a string of characters, then save those characters into an array named "s1". How can I find out how many characters they have entered because as an example they could enter "hello" which would be 5 characters or "what" which would be 4 characters. Don't know how to quantify the amount of characters that they've entered though. I would like to know how to do this in case the user enters more characters than the size of the array I would like to be able to print out an error message and then prompt them to enter a new string of characters.
Code:printf("Enter a string of characters:\n"); scanf("%s", s1);