+ 2

Find the error I

Please help to find error https://code.sololearn.com/cP1x6Aj0hHx5/?ref=app

1st Jan 2021, 1:04 PM
Mehrob Abdulvahobov
Mehrob Abdulvahobov - avatar
3 Respuestas
+ 2
use stack memory. #include <stdio.h> union test { int i; float f; char c; }; int main() { union test t; t.f = 10.10f; printf("%f", t.f); return 0; }
1st Jan 2021, 1:32 PM
Flash
+ 3
Thanks 😘
11th Jan 2021, 3:54 PM
Mehrob Abdulvahobov
Mehrob Abdulvahobov - avatar
+ 2
if you must use heap: #include <stdio.h> #include <stdlib.h> union test { int i; float f; char c; }; int main() { union test* t = NULL; t = malloc(sizeof(union test)); t->f = 10.10f; printf("%f", t->f); free(t); return 0; }
1st Jan 2021, 1:35 PM
Flash
En tendencia hoy
.
1 Votes
What?
0 Votes
HTML
0 Votes
Web
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
AI
2 Votes
help
0 Votes
APIs
1 Votes