Write an expression evaluates to "true" (i.e. non-zero) if the length of the string stored in the character array password contains six or fewer characters. In C prog
Hint: do not use spaces in your answer.
To do this we simply need to get the length of character array password .
So in C we have a function strlen( array) that returns the length of array
For Example char arr[ ] = " Password"
strlen(arr) then output will be 8
Similarly we can use this to write the C boolean expression using Comparison Operator i.e <=
Boolean Expression is
strlen(password)<= 6
Above Expression is true only when length of password is 6 or fewer
This is how you can simply write a expression in One line using strlen() function .
If u like the answer do Upvote it and have any doubt ask in comments
Get Answers For Free
Most questions answered within 1 hours.