You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need structs in the language. Structs in Corth will be stored in the stack and when we have a better way to create variables, we will add struct pointers etc. This should probably not be priority until types are improved.
// Defining a struct
struct Employee
int id
int salary
end
// Constructing a struct
3 3800 make Employee
// Get the value of a field in the struct
3 3800 make Employee let emp in
emp get id putu
// ...or...
emp get Employee id putu
end
// Set the value of a field in the struct
3 3800 make Employee let emp in
4 emp set id
// ...or...
4 emp set Employee id
end
The text was updated successfully, but these errors were encountered:
We need structs in the language. Structs in Corth will be stored in the stack and when we have a better way to create variables, we will add struct pointers etc. This should probably not be priority until types are improved.
The text was updated successfully, but these errors were encountered: