#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Question 648 I:\SP11-BCS-072\project.c [Warning] comparison between pointer and integer


    em a newbie and Em working on my project from my uni and having this trouble . . i have to get outta trouble . . cz i have to submit it on monday. . thats a hospital managment system . . 2 functions which are makin trouble
    are following:
    void que_wardno(FILE *fp);
    function prototype for query by ward no. of PATIENTS

    void que_asgwardno(FILE *fd);
    function prototype for query by assigned ward no of DOCTORS

    error window shows
    In function `que_wardno':
    In function `que_asgwardno':
    [Warning] comparison between pointer and integer

    and the code is :
    <code>
    void que_wardno(FILE *fp)
    {
    int wardno, flag =1;
    printf("Enter Ward No. of Patient: ");
    scanf("%d",&wardno);
    rewind(fp);
    while(fread(&p,sizeof(p),1,fp)==1)
    {
    if(wardno==p.wardno)
    {
    flag =0;
    printf("\nPt.No\t\t Name \t Age\tGender \tDisease/Symptoms ");
    printf("\nDate of Admit\tDate of Discharge\tWard No.\t Tests ");
    printf("\n%4d%15s\t%3d %5s %15s %8s %8s %5d %15s",
    p.ptno, p.name, p.age, p.gender, p.disease, p.addate, p.disdate, p.wardno, p.test);
    }
    }
    if (flag)
    printf("--> NO Record Exist about This Ward No <--");
    } [SIZE=7]
    </code>

    2nd is

    <code>
    void que_asgwardno(FILE *fd)
    {
    int asgwardno, flag =1;
    printf("Enter Ward No: ");
    scanf("%c",&asgwardno);
    rewind(fd);
    while(fread(&d,sizeof(d),1,fd)==1)
    {
    if(asgwardno==d.asgwardno)
    {
    flag =0;
    printf("\nPt.No\t\t Name \t Age\tGender \tDisease/Symptoms ");
    printf("\nDate of Admit\tDate of Discharge\tWard No.\t Tests ");
    printf("\n%4d%15s\t%3d %5s %15s %8s %8s %5d %15s",
    p.ptno, p.name, p.age, p.gender, p.disease, p.addate, p.disdate, p.wardno, p.test);
    }
    }
    if (flag)
    printf("--> NO Record Exist about This Ward No. <--");
    } // Closing QUERY BY ASSIGNED WARD No. FUNCTION
    </code>


    Kindly help me with this. .
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    2
    Rep Power
    0
    if(wardno==p.wardno)

    if(asgwardno==d.asgwardno)

    and these are the error lines of those functions.

IMN logo majestic logo threadwatch logo seochat tools logo