Skip to content

Sizeof Type

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Sizeof Type

sizeof can be used to get the size of type in bytes.

sizeof Type

Result Type

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

Usage Example

import basics

func main {
    heap_integer_value *int = malloc(sizeof int)
    defer free(heap_integer_value)
    
    *heap_integer_value = 10
    printf("heap_integer_value = %d\n", *heap_integer_value)
}
Clone this wiki locally