Answers ( 1 )

  1. 13 Mar 2025

    In C programming, a structure (struct) is a user-defined data type that allows grouping variables of different types under one name. It is used to store related data together, similar to a record in databases.

    Syntax of Structure in C 

    struct StructureName {    dataType member1;    dataType member2;};


    Example:

    #include ⁠⁠⁠⁠⁠⁠⁠struct Student {    char name[50];    int age;    float marks;};int main() {    struct Student s1 = {"Ali", 20, 85.5};    printf("Name: %s\n", s1.name);    printf("Age: %d\n", s1.age);    printf("Marks: %.2f\n", s1.marks);    return 0;}


    0

Leave an Answer


copik

Ask by copik

 Prev question

Next question