• + 2 comments

    you might want to try to init temp1 and temp2 to 0;

    int temp1, temp2;
    temp1 = temp2 = 0;
    
    temp1 = (a > b) ? a:b;
    temp2 = (c > d) ? c:d;
    
    return (temp1 > temp2) ? temp1:temp2;