calling function again.

im making a user operating interface with keypad like ATM .
in a point ( if (buff[10] =='R') 
and i have to goto to this function again

void testtext(uint16_t color)

how can i drive this ?

#define LCD_CS A3 
#define LCD_CD A2   
#define LCD_WR A1   
#define LCD_RD A0   

#define LCD_RESET A4

#define   BLACK           0x0000
#define   BLUE            0x001F
#define   RED             0xF800
#define   GREEN           0x07E0
#define   CYAN            0x07FF
#define   MAGENTA         0xF81F
#define   YELLOW          0xFFE0
#define   WHITE           0xFFFF

#include "TFTLCD.h"
#include <Keypad.h>

const byte ROWS = 5;
const byte COLS = 4;
char buff[11];
long lastUpdate = 0;
int x,i,e;

TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

char keys[ROWS][COLS] =
{
  {'1','6','A','D'},
  {'2','7','B','E'},
  {'3','8','C','N'},
  {'4','9','X','Y'},
  {'5','0','Z','R'},
 
};

byte rowPins[ROWS] = {40,39,38,37,36}; //connect to row pinouts
byte colPins[COLS] = {32,33,34,35}; //connect to column pinouts

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(void)
{
  Serial.begin(9600);
  Serial.println("-8 Bit LCD test!");
  tft.reset();
  tft.initDisplay();

}

void loop(void)
{
  char key = keypad.getKey();
  if (key != NO_KEY) 
  {
    buff[i] = key;
    i = i+1;
   x=x+8;
  }  
  if((millis() - lastUpdate) > 700)  // has it been >1 second since the last update?
  {
  testtext(BLACK);  
    lastUpdate = millis();
  }


if ( i==10)                                 // ask user to retry or enter the number inputed
  { testtext2(WHITE);
 }
  
if (buff[10] =='R')                        // RETRY                  
{
  testtext3(BLACK);
  i==0;
  
  
}
  
  if (buff[10] =='Z')                      // OK WITH THE STUDENT ID NEXT PASSWORD   
{
  testtext4(BLACK);
  {
   if(e<10)
  Serial.print(buff[e]);
  e++;
  }
}
}

//-------------------------------------------------------------------------------------------------------------------------------------

void testtext(uint16_t color)          // 10 press in the beginning
{
 
  if( i<11)
  {
  tft.fillScreen(BLACK);
  tft.setCursor(50, 20);
  tft.setTextColor(YELLOW);
  tft.setTextSize(2);
  tft.println("ENTER YOUR");
  tft.setCursor(50, 40);
  tft.setTextSize(2);
  tft.println("STUDENT ID");
 
  tft.setCursor(x, 75);
  tft.setTextSize(2);
  tft.print(buff);}

}

void testtext2(uint16_t color)
{
 Serial.println("-its 11th press-");
  tft.setCursor(60, 100);
  tft.setTextColor(GREEN);
  tft.setTextSize(2);
  tft.drawRect(tft.width() -60, tft.height() -80, 40 , 25, RED);
  tft.print(" if correct");
  tft.setCursor(60, 120);
  tft.print(" press  Enter");
  tft.setCursor(60, 180);
  tft.setTextColor(RED);
  tft.drawRect(tft.width() -60 , tft.height() -80, 40 , 30, RED);  
  tft.print("if wrong ");
  tft.setCursor(60, 200);
  tft.print("press  Cancel");
}

void testtext3(uint16_t color) 
{
  tft.drawRect(0, 0, tft.width(), tft.height(), WHITE);
  //tft.drawRect(tft.width() -0, tft.height() -0,240,320, CYAN);
  tft.fillRect(0, 0, tft.width(), tft.height(), WHITE);
  tft.setCursor(120, 200);
  tft.setTextColor(BLACK);
  tft.setTextSize(2);
  tft.print(" try again ");
}

void testtext4(uint16_t color) 
{
   tft.fillScreen(CYAN);
  tft.setCursor(180, 190);
  tft.setTextColor(RED);
  tft.setTextSize(2);
  tft.print(" number is entered");  
 
}

Love to help but I can't understand what you want to do.
Can you say what the sketch does and what you want it to do.

its a display system with 5*4 keypad.

  1. user asked to enter his 10 digit username.

  2. while 10 digit is pressed it will be asked whether the entered number is correct or wrong
    if correct press Z
    wrong press R

  3. if he pressed Z i have to show another window which is asking PASSWORD.
    ( i didnt implement it yet )

  4. if he pressed R again it should shift to username input window. ( the task i mentioned as number (1) ) :relaxed:

State machine time!

dear aarondc.
i didnt get you.
can u explain ?

dear aarondc.
i didnt get you.
can u explain ?

You need to understand the program flow.
Read this