'The Curses library `move` function gives an error

#include <stdio.h>
#include <stdlib.h>
#include <curses.h>

int main(int argc, char *argv[]){
    move(12, 6);
    printf("hello world !");
    return 0;
}

The move function gives an error.



Solution 1:[1]

move returns an error (ERR is -1) because curses was not initialized, e.g., using initscr.

That printf will do nothing useful in curses; you should replace that with printw (and unless your program waits for input, e.g., by calling getch, will exit immediately).

The program also should call endwin (to undo the screen-initialization, making the terminal work properly).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Thomas Dickey