Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
FloatInt
//gcc 7.4.0 //FloatInt: example of union //this code is created by Rezaul Hoque on March 31,2022;contact: jewelmrh@yahoo.com,Dhaka, Bangladesh //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #include <stdio.h> float intfloat(int); int floatint(float); float intfloat(int k) { union change{ int a; float f; }c; c.a=k; c.f=k/4; return c.f; } int floatint(float h) { union change{ int a; float f; }c; c.f=h; c.a=h*4; return c.a; } int main(void) { float b; int s; b=intfloat(8); printf ("8 is converted into %0.2f\n",b); s=floatint(8.00); printf ("8 is converted into %2d\n",s); return 0; }
run
|
edit
|
history
|
help
0
Random by thread
Add c
C141106_TablaMultiplicar
Add sum.c
romitk
tickeParsing.c
AVANCE 1 TAREA M4 - PERLAS
cstructCricPoint
C_141210_Tartaglia
Project 5 v0.11