Including files is done through the #include
directive. The libraries which accompany the compiler can be included
with #include <name.HC>
. Local files can be included with:
#include "./path/to/code.HC"
. TempleOS library functions are usually always
present and do not need a #include
.
Below MAlloc
and
MemCpy
, two library functions, are included from memory.HC
.
#include <memory.HC>class Person{ U8 name[10]; I64 age;};Person *PersonNew(U8 *name, I64 age){ Person *p = MAlloc(sizeof(Person)); MemCpy(p->name,name,sizeof(p->name)); p->age = age; return p;}Person *p1 = PersonNew("Brian", 45);"%s %d\n",p->name,p->age;