[Solved] How can write “takes 2 integers, returns a Point_t representing these integers” function in C programming?


this is really straightforward:

typedef struct
{
    int x;
    int y;
} Point_t;

Point_t f(int x, int y)
{
    Point_t p = { x, y };

    return p;
}

And (to beat possible comments upfront): no, this is not returning a reference to a local variable.

solved How can write “takes 2 integers, returns a Point_t representing these integers” function in C programming?