Tuesday, April 4, 2017

Structure declaration and input output

#include<stdio.h>

struct anything ///44 B
{
    int age;    ///4 B
    char name[10]; ///20 B           ///member definition
    char dept[10];///20 B

};
struct anything student1 ;




main()
{
    printf("         Info of student 1 : \n");

    strcpy(student1.name,"ASHIK");
    printf("Name = ");
    puts(student1.name);

    student1.age =22 ;
    printf("Age  = %d\n",student1.age);



    strcpy(student1.dept,"CSE");
    printf("Dept = ");
    puts(student1.dept);


}
///student1

/**
anything = structural tag
struct = key word

struct anything = structural data type

struct anything
member data type = int ,char
member variable = age,name ,dept
*/

No comments:

Post a Comment