C++ Structures: Passing as function Arguments

C++ Structures: Passing as function Arguments
  7 April 2021
Read more Like this Post.
if not know what's structures in C++ then read What's Structures in C++? 
We can pass the structure as function arguments and process on it in function body.
using namespace std;
struct students{
    int roll;
    int points;
    float gpa;

int showStudent(students Student){
    cout << "Student Roll: " << Student.roll << endl;
    cout << "Student Points: " << Student.points << endl;
    cout << "Student gpa: " << Student.gpa << endl;

int main(){
    students Std;
    Std.roll = 20;
    Std.points = 332;
    Std.gpa = 3.8;
    return 0;
this is the simple programme. first a structure was defined with three variables. 2nd we declare a function with argument and pass the students structure and print the structure values in main function we give some values of structure variables and call the function.
if you don't know about more structure then click on the link to read full tutorial about structures
Related Post's

structures   cpp: funtions   classes   cpp  
Not Loaded Zohaib Jozvi
0 7 April 2021
Read Latest Post.
Read other post.