try this is you need help, don't forget to compile with -lcurses.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <ncurses.h>
int main()
{
if ((initscr())==NULL)
{
perror("initsrc()");
return(EXIT_FAILURE);
}
noecho();
int maxx,maxy,curx,cury;
char ch;
getmaxyx(stdscr,maxy,maxx);
curx=maxx/2;
cury=maxy/2;
mvaddch(cury,curx,'@');
do
{
ch=getch();
mvaddch(cury,curx,' ');
if (ch=='a' && curx>1) curx--;
if (ch=='s' && cury<maxy-2) cury++;
if (ch=='w' && cury>1) cury--;
if (ch=='d' && curx<maxx-2) curx++;
mvaddch(cury,curx,'@');
refresh();
}while (ch!=27); // ESC to exit
endwin();
return(EXIT_SUCCESS);
}