23warning: assignment makes pointer from integer without a cast

Posted by FILIaS on Stack Overflow See other posts from Stack Overflow or by FILIaS
Published on 2010-04-25T17:42:00Z Indexed on 2010/04/25 18:03 UTC
Read the original article Hit count: 362

Filed under:
|
|
|

Im new in programming c with arrays and files. Im just trying to run the following code but i get warnings like that:

23 44 warning: assignment makes pointer from integer without a cast

Any help? It might be silly... but I cant find what's wrong.

#include<stdio.h>

FILE *fp;
FILE *cw;
char filename_game[40],filename_words[40];

int main()
{
    while(1)
    {
         /* Input filenames. */
            printf("\n Enter the name of the file with the cryptwords array: \n");
            gets(filename_game);
            printf("\n Give the name of the file with crypted words:\n");
            gets(filename_words);

         /* Try to open the file with the game */
            if   (fp=fopen("crypt.txt","r")!=NULL)     //line23
            {  
                printf("\n Successful opening %s \n",filename_game); 
                fclose(fp);
                puts("\n Enter x to exit,any other to continue! \n ");
                if ( (getc(stdin))=='x')
                   break;
                else
                    continue;
            }
            else
            {
                fprintf(stderr,"ERROR!%s \n",filename_game);
                puts("\n Enter x to exit,any other to continue! \n");
                if (getc(stdin)=='x')
                   break;
                else
                    continue;
            }

              /* Try to open the file with the names. */
             if   (cw=fopen("words.txt","r")!=NULL)   //line 44
            {  
                printf("\n Successful opening %s \n",filename_words); 
                fclose(cw);
                puts("\n Enter x to exit,any other to continue \n ");
                if ( (getc(stdin))=='x')
                   break;
                else
                continue;
            }
            else
            {
                fprintf(stderr,"ERROR!%s \n",filename_words);
                puts("\n Enter x to exit,any other to continue! \n");
                if (getc(stdin)=='x')
                   break;
                else
                    continue;
            }
    }   
    return 0;
}

© Stack Overflow or respective owner

Related posts about c

    Related posts about warnings