Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-Wall -Wextra -Wpedantic -Wshadow
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct s_One {
- char c;
- int i;
- float f;
- } S_One;
- typedef struct s_Two {
- double a;
- double b;
- } S_Two;
- typedef struct s_Three {
- S_One s1;
- S_Two s2;
- } S_Three;
- void f1 ( S_One s )
- {
- printf("%c ", s.c );
- printf("%d ", s.i );
- printf("%f\n", s.f );
- }
- void f3 ( S_Three s )
- {
- printf("%c ", s.s1.c );
- printf("%d ", s.s1.i );
- printf("%f ", s.s1.f );
- printf("%f ", s.s2.a );
- printf("%f\n", s.s2.b );
- }
- int main()
- {
- f1 ( (S_One){ 'a', 123, 0.1f } );
- f3 ( (S_Three) { { 'a', 123, 0.1f }, { 0.21, 0.22 } } );
- return 0;
- }
- /*
- output:
- a 123 0.100000
- a 123 0.100000 0.210000 0.220000
- */
Advertisement
Add Comment
Please, Sign In to add comment