Skip to content

Static Array Literal

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Static Array Literal

Static Array Literals can be used to declare static constant global array values. They are declared with the static keyword followed by the element type of the static array data. Their primary usage is static initialization.

static int {0, 1, 2, 3, 4}

Result Type

The result type of a static array literal is *$T where $T is the element type provided.

Usage Example

import basics

func main {
    c_strings **ubyte = static *ubyte {'Isaac', 'Andy', 'Zack', 'Ellie', null}
    
    for(p **ubyte = c_strings; *p; p = p at 1){
        printf("%s\n", *p)
    }
}
Clone this wiki locally