Structure Assignments - C Structure

C examples for Structure:Structure Definition

Introduction

One structure can be assigned to another structure of the same type using a single assignment statement.

Demo Code

#include <stdio.h>

int main(void)
{
   struct {//  w ww.  ja v  a  2s  .c o  m
      int a;
      int b;
   } x, y;

   x.a = 10;

   y = x;  /* assign one structure to another */

   printf("%d", y.a);

   return 0;
}

Result


Related Tutorials