func+struct
This commit is contained in:
parent
f6c5d6164b
commit
7a59af30af
|
@ -37,36 +37,32 @@ char *alloc(int n)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t sum (int32_t a, int32_t b) {
|
||||
|
||||
return a+b;
|
||||
}
|
||||
|
||||
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 {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
};
|
||||
|
||||
struct point * ptrS = (struct point *) alloc(sizeof(point));
|
||||
ptrS->x=0x10;
|
||||
ptrS->y=0x20;
|
||||
struct point * ptrS;
|
||||
|
||||
ptrS = (struct point *) alloc(sizeof(point));
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue