Just move one node in a iteration till start node is next node and each iteration increase the count by one.
void count(struct node *last) //last is the last node
{
struct node *p;
int count_node=0;
if(last==NULL)
{
printf("list empty\n");
return;
}
p=last->link;
do
{
count_node++;
p=p->link;
}while(p!=last->link);
printf("\nNo of nodes=%d",count_node);
}