training

Code I wrote during training
git clone git://git.bitsmanent.org/training
Log | Files | Refs | README

unionfloat.c (321B)


      1 /* Exercise 10.8 */
      2 
      3 #include <stdio.h>
      4 
      5 union floatingPoint {
      6    float f;
      7    double d;
      8    long double x;
      9 } fp;
     10 
     11 int main(void)
     12 {
     13    printf("Float double long_double: ");
     14    scanf("%f%lf%Lf", &fp.f, &fp.d, &fp.x);
     15 
     16    printf("float: %f\ndouble: %f\nlong double: %Lf\n", fp.f, fp.d, fp.x);
     17 
     18    return 0;
     19 } /* E0F main */
     20