- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 9
 
Sizeof Type
        IsaacShelton edited this page Mar 21, 2022 
        ·
        1 revision
      
    sizeof can be used to get the size of type in bytes.
sizeof Type
The resulting value will be a usize that is the size of the type in bytes.
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)
}