I have the following program where the return value is inside a if
condition. What would be the return value if the condition is not satisfied?
#include<stdio.h>
int fun(int a)
{
if(a==5)
return 100;
}
int main()
{
int i=5;
for(;i>0;i--) {
int j=0;
j=fun(i);
printf("func returns %d\n",j);
}
}
I get the following output
func returns 100
func returns 4
func returns 3
func returns 2
func returns 1
Does this program have UB?