How to pass structure to a function

Pass struct into a function


#include <stdio.h>
/*w w w . j av  a 2 s  . co  m*/
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;
}




















Home »
  C Language »
    Language Advanced »




File
Function definition
String
Pointer
Structure
Preprocessing