float functions

George T. Chen gtchen at tybalt.caltech.edu
Fri Jul 29 04:21:30 AEST 1988


Forgive me if I sound naive...

How do I get c to recognize a function as returning a float and not
a double?  It seems the moment I declare something as a function, the
compiler cast it as double.  I am primarily using sizeof to determine
the type.

Here is a sample code.

float f1()
{  return( (float) 10.0);
}

main()
{  float f1(), res;
   res = f1();
   printf("sizeof f1() is %d\n",sizeof(f1()));
   printf("sizeof res is %d\n",sizeof(res));
}

This program invariable returns 8 and 4, not 4 and 4.   Help.

		George


End of article 93282 (of 93283)--what next? [npq]
Message from sysop:  Your account has just been revoked for reading news!
Ha Ha.. just fooling. I'll let you back on now.



More information about the Comp.lang.c mailing list