Add vector con malloc

PHOTO EMBED

Sun Sep 05 2021 18:20:03 GMT+0000 (UTC)

Saved by @luisjdominguezp #c #c++

typedef struct __vector {
    int x;
    int y;
} vector;

vector* add( vector* a, vector* b ) {
    vector* r = ( vector* )( malloc( sizeof( vector ) ) );
    r->x = a->x + b->x;
    r->y = a->y + b->y;
    
    return r;
}
content_copyCOPY