Code

darpan.kattel

Darpan Kattel

• Jan. 2, 2022, 7:25 p.m.

Create a Structure named student.

Write a program to read a record of 10 students and display only the record of those students whose address is "DHARAN"

C

#include
#include
#include
#include
typedef struct student
{
    int rollno;
    char name[20];
    int age;
    char address[20];
}std;
std s[10];
void addRecord(int i)
{
    printf("Enter student's Rollno., name, age and address:\n");
    scanf("%d%s%d%s", &(s[i].rollno), s[i].name, &(s[i].age), &(s[i].address));
    printf("Record Added\n");
}
void displayRecord(int i)
{
    printf("%d\t%s\t%d\t%s\n"s[i].rollnos[i].names[i].ages[i].address);
}

int main()
{
    int i = 0;
    while(i<3){
        addRecord(i);
        getch();
        i++;
    }
    i = 0;
    while(i<3){
        if (strcmp(s[i].address"DHARAN")==0)
        {
            displayRecord(i);
        }
        i++;
    }
    return 0;
}

Output:
Create a Structure named student. | Output of C Language Code

Add comment:

Total 0 comments