OCJP

gotoxy() in C Language (Formatted Output)

To Print the line at particular location we can use gotoxy() function. Basically screen is divided in 80 Columns and 25 Rows, you can specify that where you want to print using gotoxy(x,y). Where x is Column No and Y is Row No.

Example

#include<stdio.h>
#include<conio.h>
void main()
{

	clrscr();
	//total 80 columns, 25 rows
	gotoxy(20,12); //x and y (Column and Row)
	printf("Hello");
	printf("\nGood Morning"); //Will go to next line at 0 column
	gotoxy(25,17);
	printf("How Are you Today ?"); //do not use \n
	getch();
}
gotoxy in C Langauge

Leave a Reply

Your email address will not be published. Required fields are marked *


× How can I help you?