Pass struct into a function : Structure Parameters « Structure « C / ANSI-C





Pass struct into a function

#include <stdio.h>

struct struct_type {
  int a, b;
  char ch;
} ;

void f1(struct struct_type parm)
{
  printf("%d", parm.a);
}



int main(void)
{
  struct struct_type arg;

  arg.a = 1000;

  f1(arg);

  return 0;
}


  

           
       










Related examples in the same category