Untitled

mail@pastecode.io avatar
unknown
c_cpp
18 days ago
625 B
2
Indexable
Never
#include <stdio.h>

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

Point sumPoint( const Point point1, const Point point2 )
{
    Point resultPoint;

    resultPoint.x = point1.x + point2.x;
    resultPoint.y = point1.y + point2.y;

    return resultPoint;
}

void displayPoint( const Point point )
{
    printf( "Point = ( %d, %d )", point.x, point.y );
}

int main()
{
    Point point1;
    point1.x = 5;
    point1.y = 6;

    Point point2;
    point2.x = 5;
    point2.y = 4;

    Point resultPoint = sumPoint( point1, point2 );
    displayPoint( resultPoint );

    return 0;
}

Leave a Comment