You are here

getx function in C

The function getx returns the X coordinate of the current position.

Declaration: int getx();

C program of getx

  1. #include <graphics.h>
  2. #include <conio.h>
  3.  
  4. main()
  5. {
  6.    int gd = DETECT, gm;
  7.    char array[100];
  8.  
  9.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  10.  
  11.    sprintf(array, "Current position of x = %d", getx());
  12.  
  13.    outtext(array);
  14.  
  15.    getch();
  16.    closegraph();
  17.    return 0;
  18. }