C: comparing two strings from a struct
<p>I am almost brand new to C and was wondering how to compare strings from two separate struct member-variables. Maybe providing my code will bring clarity to what I am asking.</p>

<p>I have the following structure:</p>

<pre><code>typedef struct mentry {
     char *surname;
     int house_number;
     char *postcode;
     char *full_address;
} MEntry;
</code></pre>

<p>I want to compare two seperate MEntry variables. I want to check if the surname of both entries is the same. So, I've written the following method:</p>

<pre><code> int me_compare(MEntry *me1, MEntry *me2) 
 {

     int surnameResult;


     char me1Surname = *(me1-&gt;surname);
     char me2Surname = *(me2-&gt;surname);

     surnameResult = strcmp(me1Surname, me2Surname);
     return surnameResult;
}
</code></pre>

<p>When I compile my program I get the following messages:</p>

<pre><code> mentry.c:30:6: warning: passing argument 1 of ‘strcmp’ makes pointer from integer without a cast [enabled by default]
  surnameResult = strcmp(me1Surname, me2Surname);
</code></pre>

<p>Am I wrong in thinking that the line:</p>

<pre><code> char me1Surname = *(me1-&gt;surname);
</code></pre>

<p>sets me1Surname equal to the value of surname and not the address of surname?</p>

<p>I also get another warning saying:</p>

<pre><code>"In file included from mentry.c:2:0:
 /usr/include/string.h:140:12:note: expected ‘const char *’ but argument  is of type ‘char’
extern int strcmp (const char *__s1, const char *__s2)"
</code></pre>

<p>Can someone explain why this warning appears?</p>