<<<Index>>>

Adding functions to structs



struct point {
    int x; // member variables
    int y;
    void adjust( int x_, int y_ ) // member function
    {
        x += x_;
        y += y_;
    }
}; // don't forget this semicolon

void main()
{
    // Now we can:
    point p;
    p.x = p.y = 4; // access to member variables
    p.adjust( 1, 1 ); // member function call
}

<<<Index>>>