Mega Code Archive

 
Categories / C / Code Snippets
 

Pass struct into a function

#include <stdio.h> struct struct_type { int i, j; char ch; } ; void f1(struct struct_type parm) { printf("%d", parm.i); } int main(void) { struct struct_type arg; arg.i = 1000; f1(arg); return 0; }