message queues

#include <sys/ipc.h>
#include <sys/msg.h>

int main()
{
int qid;
int t;
struct msgbuf mesg;
qid=msgget(IPC_PRIVATE,IPC_CREAT);
mesg.mtype=1L;
mesg.mtext[0]=1;
t=msgsnd(qid,&mesg,1,0);
printf("%d",t);
}

the program prints -1 as the result of msgsnd ,which means that msgsnd doesn't work...any ideas??

Print out errno too to why it doesn't work.