Table of Content

gotoxy function >> conio.h header file >> Move Cursor to Specified Position

Basic You Should know ?

Header File : conio.h
Function : gotoxy
Return Type : Void

Purpose :

  1. Positions cursor in text window .
  2. Moves Cursor to Position Specified i.e at (x,y)
  3. If the coordinates are invalid, the call to gotoxy is simply ignored by Compiler
  4. The origin is located at (1,1) the upper-left corner of the window
  5. Maximum x Co-ordinate in Text Mode = 80.
  6. Maximum y Co-ordinate in Text Mode = 25.

Syntax :

void gotoxy(int x, int y);
  • x represents “New X Co-ordinate”
  • y represents “New Y Co-ordinate”
int main(void)
printf("Hello world");
return 0;

Care Should be Taken :

printf("nHello world");
  • In the Above Example You will unable to see expected Output instead Output will be printed at position (1,16) because of leading Newline Character (n) in printf

Example of invalid coordinates:

gotoxy(40,30) /* (35,25) = window's bottom right position */