moving directory

what is the system call for moving directory?
i tried
main(int argc, char * argv[]){
if(link(argv[1], destinationDir)==-1){
perror("link failed");
//argv[1] is the name of the directory i want to move input from command promt.

it displayed the link failed message.
thanks

You're not supposed to use link()/unlink() on directories anymore. You create directories with mkdir(). You remove them with rmdir(). And you rename them with rename(). What you are attempting is a rename operation.

With link() you had to: link it to the new name, unlink the old name. And if the parent changed, unlink .. and link in a new ..
But rename() will do all of this atomically. Even if you write your program correctly using link/unlink, if it dies during the process, your filesystem will be hosed.

And anyway, only root can link/unlink directories.