title: How to change values of a struct passed to a function
body: <p>Hi friends I am practicing structures.  I have these two functions one returns the structure and I copy that to the local struct in main. My second function changes those local struct members by entering different entities. 
      Now I have printed result after calling each function, to my surprise I notice that printed result after both the function are same. I am unable to understand what is happening here…can you guys please explain me…thanks!</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;stdlib.h&gt;
  
   struct student{
          char name[30];
          float marks;
          };
  
  
   struct student read_student();
   void read_student_p(struct student student3);
   void print_student(struct student student2);
  
   int main()
   {
       struct student student1;
       student1 = read_student();
       print_student(student1);
       read_student_p(student1);
       print_student(student1);
       system("pause");
       return 0;
   }
  
   //This is my first function
   struct student read_student()
   {
        struct student student2;
        printf("enter student name for first function: \n");
        scanf("%s",&amp;student2.name);
  
        printf("enter student marks for first function:\n");
        scanf("%f",&amp;student2.marks);
  
        return student2;
   }
  
  //function to print 
  void print_student(struct student my_student)
  {
      printf("Student name in first function is : %s\n",my_student.name);
      printf("Student marks in first function are: %f\n",my_student.marks);
  };
  
   //My second function  
   void read_student_p(struct student student3)
   {    
        printf("enter student name for second function: \n");
        scanf("%s",&amp;student3.name);
        printf("enter student marks for second function: \n");
        scanf("%f",&amp;student3.marks);
   }
  </code></pre>