Please fix your indentation next time you post code so people can actually read and understand it.
Code:
node *head, *current, *a, *b;
Global Variables Are Bad
Code:
if(head==NULL)
{
newNode->next=head;
newNode->prev=head;
head = newNode;
return 0;
}
When you assign the next and prev elements, head is NULL, so you don't actually have a circular list here. That might throw off your subsequent inserts. You probably want head = newNode as the first line in this block.
Code:
current=head;
while(current->next==head)
{
current->next = current;
}
Your loop condition looks backwards. You want to keep while the next element doesn't point to the head of the list (i.e. while current isn't the last node in the list).
Code:
current->next=newNode;
newNode->next = head;
head->prev=newNode;
return 0;
You probably want to set newNode->prev to current here.