Why to copy all the elements

int current=0;
int largest=current;
for(;current<5;current++){
    if(strlen(str[current])>strlen(str[largest])){
        largest=current;
    }
}

the above code is working fine.Is this the correct way ?bcoz i am getting the right output.

hi @GIRISHVIJ
this will only work when string have different lengths
for inputs
bat
rat
cat
what you code give??

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.