[C / C ] Gotoxy() in Dev-C – Gotoxy in Dev-C

In Dev-C default content gotoxy(x, and). We need to build it using the library windows.h as follows:

void gotoxy(int x, int y)
{
  static HANDLE h = NULL;  
  if(!h)
    h = GetStdHandle(STD_OUTPUT_HANDLE);
  COORD c = { x, y };  
  SetConsoleCursorPosition(h,c);
}

CEO:

#include <stdio.h>
#include <windows.h>
void gotoxy(int x, int y)
{
	static HANDLE h = NULL;  
	if(!h)
		h = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD c = { x, y };  
	SetConsoleCursorPosition(h,c);
}
int main(){
	char *s = "nguyenvanquan7826";
	gotoxy(40 - strlen(s)/2, 1);
	printf("%snn", s);
}

gotoxy in dev-c