This is a code from geeksforgeeks counting sort implementation:
The have used the below for loop to iterate through a string -
char arr[] = "geeksforgeeks";
for(i = 0; arr[i]; ++i)
++count[arr[i]];
From google search I could understand that this condition implicitly evaluates to arr[i]!='\0'
. Have I understood it correctly ?
If I were to use a similar for loop to iterate through an array of integers, would it evaluate to arr[i]!=0
?
Or is there any better way to iterate through an array of integers when we do not know its size. I am a beginner and please try to provide suggestions which do not involve advanced data structures in C.