I tried to see what is happening to this code "under the hood" using GDB.
At the moment my GDB works in only in linux terminal and, as stated in the title, I get the expected (logical) output whenever I run this code in here.
I think the problem lies arount the return from func().
Running the same code in cmd gives " not equal" and in terminal it gives "equal". 
Why is this happening?
I use gcc to compile the code
Here is the code:
 #include <stdio.h>
double func(){
     double y= 5 ;
     return (double)y/3;
    /*// Code that works as expected:
    double y= (double)5/3;
    return y;
     */
}
    int main()
{
    double x ;
    x= (double)5/3;
    if (x == func())
        printf("%lf equal to %lf\n", x ,func());
    else
        printf("%lf not equal to %lf\n", x, func());
    return 0;
}
 
    