In Windows i used flushall() function to flush all the buffers but this doesnt work in Linux, my scanf() function skips without scanning:
for(i=0;i<n;i++)
   {
    printf("\nEnter alphabet :");
    scanf("%c",&x);
    printf("\nEnter frequency :");
    scanf("%f",&probability);
  /* create a new tree and insert it in
     the priority linked list */
    p=(treenode*)malloc(sizeof(treenode));
    p->left=p->right=NULL;
    p->data=x;
    p->freq=(float)probability;
    head=insert(head,p);
  }
Output :
mayur@mayur-laptop:~$ ./a.out
Enter alphabet :a
Enter frequency :2
Enter alphabet :
Enter frequency :a
Enter alphabet :
Enter frequency :2
Enter alphabet :
Enter frequency :a
Enter alphabet :
 
     
    