Passing structure type arguments in C Language

Passing structure type arguments in C Language

Structure type variables can be passed as arguments to functions. .In this case structure variable is passed as an actual argument to a function.

Program to demonstrate passing structure type variable as argument .

#include<stdio.h>
struct demo
{
  int x,y;
};
void disp(struct demo d1)
{
  ++d1.x;
  - -d1.y;

  printf("\nd1.x=%d",d1.x);
  printf("\nd1.y=%d",d1.y);
}
int main()
{

  struct demo d={10,15};
  show(d1);
  return(0);
}

Output

d1.x=11
d1.y=14

Spread the love
Lesson tags: passing structure type arguments by reference, passing structure type arguments by value, passing structure type arguments to function, Structure type arguments in C Language
Back to: C Programming Language
Spread the love