Logo 
Search:

C Programming Articles

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

Example of passing structure to function

Posted By: Mikayla Campbell     Category: C Programming     Views: 9125

Example of passing structure to function.

Code for Example of passing structure to function in C Programming

struct student
     {
    name char[30];
    marks float;
     }
main ( )
{
    struct student student1;
    student1 = read_student ( )
    print_student( student1);
    read_student_p(student1);
    print_student (student1);
 }
struct student read_student( )    \\ A
{
    struct student student2;
    gets(student2.name);
    scanf(“%d”,&student2.marks);
    return (student2);
}
  void print_student (struct student student2)    \\ B
{
printf( “name is %s\n”, student2.name);
printf( “marks are%d\n”, student2.marks);
}
  void read_student_p(struct student student2)    \\ C
{
    gets(student2.name);
    scanf(“%d”,&student2.marks);

}
  
Share: 


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

Mikayla Campbell
Mikayla Campbell author of Example of passing structure to function is from Toronto, Canada.
 
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!