MCQs > IT & Programming > C Programming > Following statement where str is a character array and the statement is supposed to traverse through the whole character string str? for(i=0;str[i];i++)

C Programming MCQs

What is the error in the following statement where str is a character
array and the statement is supposed to traverse through the whole
character string str?
for(i=0;str[i];i++)

Answer

Correct Answer: The condition should be str[i] != '\0'

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C Programming Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

C Programming Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it