Easy learning with example program codes

CPP Structs

Structs are blueprints in CPP. Like classes, CPP structs are used to create instance of a class, but are preferred only for lightweight objects which are not intended to any future modifications. The lightweight objects include, Rectangle, color, Point etc. A CPP class uses Call by Value method for calling while, CPP structs uses Call by Reference method for calling.


#include <iostream.h>  
using namespace std;  
struct Sphere  
int radius;    
int main()
struct Sphere circle;  
cout<<"Area of Sphere is: "<<(4*3.14* circle.radius*circle.radius)<<endl;  
return 0;  


Area of Sphere is: 803.84
Posted in CPP   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki