There was an error while loading. Please reload this page.
C-String literals are strings surrounded with single quotes:
'Hello World'
'John'
'Welcome, Isaac Shelton.'
They are null-terminated and are of type *ubyte. They should not be modified without first creating a copy.
*ubyte
import basics func main { firstname *ubyte = 'Isaac' lastname *ubyte = 'Shelton' fullname *ubyte = malloc(strlen(firstname) + 1 + strlen(lastname) + 1) defer free(fullname) sprintf(fullname, "%s %s", firstname, lastname) greet(fullname) } func greet(fullname *ubyte) { printf("Welcome %s!\n", fullname) }
Table of Contents