#include <iostream>
using namespace std;
struct rectangle
{
int length;
int breadth;
};
int main() {
rectangle *p;
// in C, struct rectangle *p;
p = new rectangle;
//in C, p = (struct rectangle *)malloc(sizeof(struct rectangle));
p->length = 15;
p->breadth= 7;
cout << "length : "<<p->length<<endl;
cout << "breadth : "<<p->breadth<<endl;
return 0;
}
Preview:
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