c - How do you call a function with an array of structs? -


i have following lcd driver code, , unsure how call function

typedef struct  {   int16_t x;   int16_t y; } point, * ppoint;  void lcd_polyline(ppoint points, uint16_t pointcount) {   int16_t x = 0, y = 0;   while(--pointcount) {     x = points->x;     y = points->y;     points++;     lcd_drawuniline(x, y, points->x, points->y);   } } 

it doesn't make sense have first argument of function "ppoint points". me seems should "ppoint *points". create array of ppoints , pass address it.

how else call driver function without modifying it?

it doesn't make sense have first argument of function ppoint points.

it makes perfect sense, because ppoint defined point*, i.e. pointer point. equivalent to

void lcd_polyline(point *points, uint16_t pointcount) 

which correct signature. need pass array of struct point, followed count of elements in it.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -