How to create short names for floating point types in C

1 Answer

0 votes
#include <stdio.h>

typedef float f32;
typedef double f64;

int main(void) {
    f32 f = 3.14f;
    printf("%f\n", f);
    
    f64 d = 945673.467f;
    printf("%lf", d);
    
    return 0;
}



/*
run:

3.140000
945673.437500

*/

 



answered Apr 26, 2022 by avibootz

Related questions

1 answer 155 views
1 answer 132 views
1 answer 166 views
166 views asked Aug 24, 2017 by avibootz
1 answer 114 views
1 answer 162 views
1 answer 122 views
...