Home

A program to copy one structure into another structure

C Programming Language 090

Program

#include <stdio.h>

void main()
{
    struct nums
    {
        int a, b;
    } n1, n2;
    printf("Enter values for n1: ");
    scanf("%d %d", &n1.a, &n1.b);
    n2 = n1;

    printf("Values in n2 are...\n%d\t%d", n2.a, n2.b);
    printf("\n");
}

Result

Enter values for n1: 1 4
Values in n2 are...
1       4


Last Updated on

Next Post: Rules vs Guidelines →

Comments