Program jumps alone from void loop() to another void //simple alarm system
int RipSensor1 = 12;
int RmkeyA = 3;
int RmkeyB = 5;
int RmkeyC = 6;
//--------------------------------------------------------------------------

void setup()
 {
  Serial.begin(9600);
  pinMode(RipSensor1,INPUT);
  pinMode(RmkeyA,INPUT);
  pinMode(RmkeyB,INPUT);
  pinMode(RmkeyC,INPUT);
  pinMode(13,OUTPUT);
  Serial.println(F("System Is Up &amp; Running")); }
  //----------------------------------------------------------------------

void loop()
 {
  Serial.println(F("Main Loop Start")); 
  digitalWrite(13,LOW);   //for debugging
  if (digitalRead(RmkeyA) == HIGH)
   {
    Rip1Status();
   }
 }
//----------------------------------------------------------------------

void AlarmSMS1()
 {
  //send sms to admin1
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));  
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));  
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Serial.println(F("SMS Sending to 1st ADMIN ---&gt;"));
  Rip1Status();   // return to this void (monitoring)
 }
//----------------------------------------------------------------------

void Rip1Status()
 {
  Serial.println(F("VOID Rip1 Start..."));
  while (digitalRead(RmkeyB) == LOW) //Arm mode
   { 
    digitalWrite(13,HIGH);
    if (digitalRead(RipSensor1) == HIGH) //when Rip sensor sense motion
     {
      Serial.println(F("Movement ALARM --&gt; PowerUP Relay 1 &amp; 2"));
      long RipTimer1 = 0;
      long Rip01 = 0;
      int z = 0;
      int x = 0;
      while (digitalRead(RmkeyC) == LOW)
       {
        RipTimer1++;  
        Serial.println(RipTimer1);   //for debugging
        if((z==0) &amp;&amp; (RipTimer1 - Rip01 &gt; 500))   //1st CheckPoint do something 
         {
          z = 1;
          Serial.println(F("1st CheckPoint OK"));
         }
        else if((x==0) &amp;&amp; (RipTimer1 - Rip01 &gt; 3000))   //2nd CheckPoint go on other void
         { 
          x = 1;
          AlarmSMS1();
         }
       }
      Serial.println(F("C Key Pressed --&gt; False Alarm"));    //if button C pressed
      RipTimer1 = 0; 
      z = 0;
      x = 0;
      Serial.println(F("Monitoring Loop ends --&gt; GoTo Main Loop"));  
      break;
     }
    else Serial.println(F("Monitoring"));  //for debugging
   }
  Serial.println(F("B Key Pressed --&gt; Disarming"));  //for debugging
  Serial.println(F("Monitoring Loop ends --&gt; GoTo Main Loop"));  
  loop();
 }


I make this code &amp; i have this problem:
Program start &amp; wait for A key pressed to Arm mode. works ok
Press A key go to Arm mode (monitoring). works ok
When its on "monitoring", if i press B key, system disarming then go to void loop() and wait. works ok
When its on "monitoring" &amp; Rip sensor sense movement, then alarm start and if i press C key then disarming as false alarm and go to void loop() and wait. works ok
When its on "monitoring" &amp; Rip sensor sense movement, if i left alarm to complete, go to sms void send sms to admin and return to Rip void (monitoring).
But on this point if i press B button to disarm system this happen...  

Monitoring
Monitoring
Monitoring
Monitoring
Monitoring
Monitoring
Monitoring
Monitoring
Monitoring
Monitoring
B Key Pressed --&gt; Disarming
Monitoring Loop ends --&gt; GoTo Main Loop
Main Loop Start
3002
3003
3004
3005
3006
3007
3008
3009 
3010
3011
3012.............


Why this happen?
What i am doing wrong?
loop() calls Rip1Status(), which calls loop(), which calls Rip1Status(), which calls loop(), which calls ....

That process will continue until the stack overflows (runs out of memory) or over-writes some necessary variable. If you just meant for Rip1Status() to return to the main loop, delete the loop() call at the end of the function. When Rip1Status()exits, control will automatically return toloop()at the statement following theRip1Status()` call.