Add sizeof test
This commit is contained in:
33
test/sizeof.w12
Normal file
33
test/sizeof.w12
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
struct BigStruct {
|
||||||
|
name: [char],
|
||||||
|
number: int,
|
||||||
|
number2: int,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BiggerStruct {
|
||||||
|
character: char,
|
||||||
|
big: BigStruct,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SmallStruct {
|
||||||
|
value: int,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn main() -> int {
|
||||||
|
printf("Size of int: %u\n", sizeof int);
|
||||||
|
printf("Size of uint: %u\n", sizeof uint);
|
||||||
|
printf("Size of float: %u\n", sizeof float);
|
||||||
|
printf("Size of [char]: %u\n", sizeof [char]);
|
||||||
|
printf("Size of [int]: %u\n", sizeof [int]);
|
||||||
|
printf("Size of bool: %u\n", sizeof bool);
|
||||||
|
printf("Size of int*: %u\n", sizeof int*);
|
||||||
|
printf("Size of bool*: %u\n", sizeof bool*);
|
||||||
|
printf("Size of BigStruct*: %u\n", sizeof BigStruct*);
|
||||||
|
printf("Size of SmallStruct*: %u\n", sizeof SmallStruct*);
|
||||||
|
printf("Size of BigStruct: %u\n", sizeof BigStruct);
|
||||||
|
printf("Size of BiggerStruct: %u\n", sizeof BiggerStruct);
|
||||||
|
printf("Size of SmallStruct: %u\n", sizeof SmallStruct);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user