-1

How do I go about getting around this warning? it obviously prevents me from compiling with gcc. Am I missing something?

#include <stdio.h>
#include <string.h>
int main(void) { 

         int MAX_TWEET_SIZE = 32;
         char target_tweet[MAX_TWEET_SIZE];
         int MAX_SIZE = 140
         char tweet[MAX_SIZE];
          int match = 0;

         printf("Enter Target Tweet\n");

         fgets(target_tweet, MAX_TWEET_SIZE, stdin);

         if (target_tweet[0] != '#'){
                         printf ("ERROR\n");
                         return 0;
                 }


         printf("Enter Tweets!\nenter '.' to quit:\n"){

         while (1){
                 scanf("%s", tweet);
                 if (strcmp(tweet, target_tweet == 0)){ /* error comes in here */
                         print ("Tweet Matched.\n");
                         match = match + 1;
                 }

                 if ((tweet[0] = '.')){
                         printf("%d tweet(s) matched\n", match);
                         break;
                  }
          }
return 0;
}

(if there are any spelling mistakes they were because I had to type the code manually cause it's not letting me copy paste from my compiler...)

Basically I'm trying to get around the warning "the address of 'target_tweet' will never be NULL if possible. I'm 100% clueless.

Joseph
  • 9
  • 2

1 Answers1

-2

You have a typo here

strcmp(tweet, target_tweet == 0)

this should be

strcmp(tweet, target_tweet) == 0
Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97