I will have to take the input from user and find the longest input from those 10 strings..
#include<stdio.h>
#include<conio.h>
void main() {
char str[10][10]
printf("Enter strings:")
scanf("%s", str)
}
If I take the user input like this, would it store the strings in str two dimensional array? To find out the longest string first I would find the length of each strings and use max_length function to determine the longest string.
You do not need to store all of the strings, just the longest one entered so far.
Note that you do need to define a maximum length of string to avoid buffer overrun.
For example:
Use a loop to accept the ten inputs and compare with the longest string. If the last entered string is longer then copy it into the longest string. As this is homework I’ll not provide any further code.