STRUCTURE IN C PROGRAMMING.

 #include <stdio.h>

#include<string.h>
struct student
{
    int id;
    int marks;
    char fav_char;
    char name[34];

};

int main()
{
    struct student aatifa, xyz, abc;
    aatifa.id = 1;
    xyz.id = 2;
    abc.id = 3;
    aatifa.marks = 445;
    xyz.marks = 450;
    abc.marks = 451;
    aatifa.fav_char = 'p';
    xyz.fav_char = 'p';
    abc.fav_char = 'p';
    strcpy(aatifa.name, "aatifa is a programmer");
    printf("aatifa got %d marks\n", aatifa.marks);
     printf("aatifa's name is: %s\n", aatifa.name);


    return 0;
}

OUTPUT:
aatifa got 445 marks aatifa's name is: aatifa is a programmer

Comments

  1. This is one of the most important topic... Thank you ma'am

    ReplyDelete

Post a Comment

Popular posts from this blog

C Program using continue statement

C program of WHILE Loop

NULL Pointer in C.

C Program using DO WHILE loop

C Program using SWITCH statement

New Animated Login or signup page made by HTML, CSS and JavaScript.

C Program to print multiplication table of any number.

C Language Travel Agency Manager Exercise.