C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Example 2 of structure

Posted By: Adalwin Fischer     Category: C Programming     Views: 3006

Program that illustrates an example of structure.

Code for Example 2 of structure in C Programming

struct student        \\ A
    char name[30];    \\ B    
    float marks;    \\ C
    }  ;             \\ D
main ( )
    struct student *student1;    \\ E   
    struct student student2;    \\ F
    char s1[30];        
    float  f;            
    student1 = &student2;    \\ G
    scanf (“%s”, name);    \\ H
    scanf (“ %f”, & f);    \\ I
    *student1.name = s1;    \\ J  student1-> name = f;
    *student2.marks = f;    \\ K  student1-> marks = s1;

 printf (“ Name is %s \n”, *student1.name);    \\ L
 printf (“ Marks are %f \n”, *student2.marks);    \\ M

Didn't find what you were looking for? Find more on Example 2 of structure Or get search suggestion and latest updates.

Adalwin Fischer
Adalwin Fischer author of Example 2 of structure is from Frankfurt, Germany.
View All Articles

Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

No Comment Found, Be the First to post comment!