RicardasSim icon

testing arguments

RicardasSim | PRO | 02/02/23 08:38:10 PM UTC | 0 ⭐ | 1344 👁️ | Never ⏰ | []
C |

780 B

|

None

|

0 👍

/

0 👎

//-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
 
*/
 

Comments