gotoxy() function in Code::blocks(gcc compiler) using C

In Turbo C/C++ and Borland C++ compiler, gotoxy() is build in function. You need not have to write its function definition. All you have to do is call the function with arguments as x and y coordinate. But in modern C compiler like gcc and IDE Code::Blocks, gotoxy() is not  build-in function, you have to define it before use them. The following code is the function definition for gotoxy(). Remember: This function only works on windows, because the function definition includes functions of header file “windows.h”. So to use gotoxy() you must include “windows.h”.
 
COORD coordinate = {0,0}; //initialization
 
 
 
void gotoxy(int x, int y){ //function definition
 
   coordinate.X = x; coordinate.Y =  y;
 
   SetConsoleCursorPostion(GetStdHandle(STD_OUTPUT_HANDLE),coordinate);
 
}
 

NOTE: coordinate (0,0) is left-top corner of your window.