#include <iostream>
using namespace std;

struct rectangle
    int length;
    int breadth;

int main() {
   rectangle r={10,5};
   cout <<"length : "<<r.length<<endl;
   cout <<"breadth : "<<r.breadth<<endl<<endl;
   cout << "using pointer : " <<endl;
   rectangle *p =&r;  
   cout <<"length : "<< p->length <<endl;
   cout <<"breadth : "<< p->breadth <<endl;

    return 0;
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter