now i know there's a simple way to calculate higest value.

but here i have this algorithm which i understood part of it.

the parts that i didn't understand i marked which comments ( //) .

if someone could show me the first iteration of it. it would help understand it better. i know that *largest is point to the first element of begin which is 5. so in the first if statement its 5<5 at the first iteration ?

Code:

// i marked the parts i didnt understand with " //"
#include <stdio.h>
int *print(int *begin ,int *end ){
if(begin==end)
return 0;
int *largest = begin;
for (; begin!=end; begin++){
printf("%d\n", *begin); // until here i understood.
if(*largest < *begin){ //from here i didnt understand.
largest = begin; // also...
}
}
return largest;
}
int main(){
int numbers[]={5,1,22,26,2};
int size= sizeof(numbers) / sizeof(numbers[0]);
int *largest = print(numbers , numbers+size); // from here also didnt understand
if (largest) { //also ....
printf("largest %d\n", *largest);
}
}
//thanks