func+struct

This commit is contained in:
mpabi 2024-05-17 10:13:06 +00:00
parent f6c5d6164b
commit 7a59af30af
1 changed files with 18 additions and 22 deletions

View File

@ -37,36 +37,32 @@ char *alloc(int n)
return 0; return 0;
} }
int32_t sum (int32_t a, int32_t b) {
return a+b;
}
int main() { int main() {
char * s = "mpabi";
uint8_t wynik =0;
wynik = strlen (s);
asm("nop");
char * p1 = alloc(strlen(ptr1));
strcpy (p1, ptr1);
asm("nop");
char * p2 = alloc(strlen(ptr2));
strcpy (p2, ptr2);
asm("nop");
struct point { struct point {
int16_t x; int32_t x;
int16_t y; int32_t y;
}; };
struct point * ptrS = (struct point *) alloc(sizeof(point)); struct point * ptrS;
ptrS->x=0x10;
ptrS->y=0x20; ptrS = (struct point *) alloc(sizeof(point));
asm("nop"); asm("nop");
(*ptrS).y= strlen (p1)+ strlen(p2); ptrS->x=0x10;
ptrS->y=0x20;
int32_t wynik = 0;
wynik = sum ( (*ptrS).x, ptrS->y);
asm("nop");
return 1; return 1;
} }