Need help in Understanding an output problem of C++
I saw a problem to know the output of the below mentioned code..
#include<stdio.h>
int fun()
{
static int num = 40;
return num--;
}
 
int main()
{
for(fun(); fun(); fun())
{
printf("%d ", fun());
}
 
return 0;
}Now my problem is that, I've never seen that we can use a function call in initialisation, updation and conditional expression of a for loop.So, first of all, is this correct?
and how we judge the output..?
 
                                             
 
                                 
                                