title: C - While loop error
body: <p>im trying understand why i get this output, i put a while loop to go out to another method, i dont know why it doesnt working! the operation on debug show me value 1, the same condition to intry on the if clausule and invoke the register method to print "Test" on the screen.</p>
  
  <pre><code>//Struct Student
  typedef struct {
  
      char name[50];
      float grade[4];
      int status;
  
  } Student;
  
  Student students[MAX_STUDENT];
  
  //Methods Statements
  void menu();
  void registerStudent();
  void deleteStudent();
  void reproved();
  void search();
  
  int operation;  
  
  int main() {
  
      menu();
      return 0;
  }
  
  //Display menu
  void menu(){
  
      system("cls");   
  
      while(operation != 5){
  
  
          printf("1 - Register Student\n");
          printf("2 - Delete Student\n");
          printf("3 - Reproved Students\n");
          printf("4 - Find Student\n");
          printf("5 - Exit\n");
          scanf("%i", &amp;operation);    
  
          if(operation == 1){
              registerStudent();
          }   
  
      };
  
  }
  
  void registerStudent(){
  
      char name[50];
  float grade[4];
  
  int op;
  int i;
  
  while(op != 0){
  
      system("cls");
      printf("Type the name: ");
      //Fgets to read line
      fgets(name, sizeof(name), stdin);
      printf("First two months: ");
      scanf("%f", &amp;grade[0]);
      printf("Second two months: ");
      scanf("%f", &amp;grade[1]);
      printf("Third two months: ");
      scanf("%f", &amp;grade[2]);
      printf("Fouth two months: ");
      scanf("%f", &amp;grade[3]);
      printf("1 - Continue\n");
      printf("0 - Exit\n");
  
      for(i=0; i&lt;MAX_STUDENT; i++){
  
          if(students[i].status == 0){
  
              students[i].grade[0] = grade[0];
              students[i].grade[1] = grade[1];
              students[i].grade[2] = grade[2];
              students[i].grade[3] = grade[3];
              strcpy(students[i].name, name);
              break;
          }
      }
  
  }
  
  }
  </code></pre>
  
  <p>Output:</p>
  
  <p><a href="https://i.stack.imgur.com/sMHNE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sMHNE.png" alt="enter image description here"></a></p>
  
  <p>PS: Now its working!</p>