Skip to content

Sizeof Value

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Sizeof Value

sizeof can be used to get the size of a value in bytes, if it's given a value surrounded by parentheses.

sizeof(my_value)

Result Value

The resulting value will be a usize that is the size of the type of the value in bytes.

Usage Example

import basics

func main {
    my_integers 100 int
    number_of_integers usize = sizeof(my_integers) / sizeof int
    printf("Capacity of number_of_integers: %zu integer(s)\n", number_of_integers)
}
Clone this wiki locally