forked from spevnev/uprintf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstruct.c
70 lines (53 loc) · 1.15 KB
/
struct.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "uprintf.h"
typedef int8_t i8_t;
typedef char *cstr;
typedef double long_float;
typedef struct {
uint8_t u8;
unsigned short u16;
unsigned u32;
long unsigned long int u64;
i8_t i8;
short int i16;
int32_t i32;
signed long int i64;
signed char sch;
unsigned char uch;
float f32;
long_float f64;
void *void_ptr;
int *int_ptr;
float *null_ptr;
char *ch_ptr;
const char *str;
const cstr const_str;
bool b;
} Struct;
int main(void) {
int i = 5;
Struct s = {
.u8 = 255,
.u16 = 65535,
.u32 = 4294967295,
.u64 = 18446744073709551615UL,
.i8 = -128,
.i16 = -32768,
.i32 = -2147483648,
.i64 = -9223372036854775807L,
.f32 = 0.123,
.f64 = -0.321,
.uch = 'c',
.sch = -'c',
.void_ptr = &i,
.int_ptr = &i,
.null_ptr = NULL,
.str = "str string",
.const_str = "const_str string",
.b = true,
};
uprintf("Struct containing all types: %S\n", &s);
return _upf_test_status;
}