user7806: I'm writing some code for Arduino and I'm not sure if I'm checking the value of this character variable correctly. Can you please tell me if this is correct:
const char* front = "front";
const char* back = "back";

eyeballs(front);
eyeballs(back);

void eyeballs(const char* frontOrBack){ 

if (frontOrBack == "front") {
    digitalWrite(frontEyes, LOW);}//end if   
  else if (frontOrBack == "back") {
    digitalWrite(backEyes, LOW);}//end else*/
}  


user-1: Another option would be an enum.
enum
{
   FRONT,
   BACK
}
.
.
.
   if (frontOrBack == FRONT)
   {
      // Stuff
   }
   else if (frontOrBack == BACK)
   {
      // Some other stuff
   }


user396: Since you are using C strings (array of characters) instead of the C++ String class, you cannot use the == operator.
Instead, you can use the C style strcmp function, which is also part of the C++ library:
    #include <string.h>
       .
       .
       .

    if (!strcmp(frontOrBack,"front")) {
        digitalWrite(frontEyes, LOW);}//end if   
    else if (!strcmp(frontOrBack,"back")) {
        digitalWrite(backEyes, LOW);}//end else*/
    } 


7806: <p>I'm writing some code for Arduino and I'm not sure if I'm checking the value of this character variable correctly. Can you please tell me if this is correct:</p>

<pre><code>const char* front = "front";
const char* back = "back";

eyeballs(front);
eyeballs(back);

void eyeballs(const char* frontOrBack){ 

if (frontOrBack == "front") {
    digitalWrite(frontEyes, LOW);}//end if   
  else if (frontOrBack == "back") {
    digitalWrite(backEyes, LOW);}//end else*/
}  
</code></pre>
 -1: <p>Another option would be an enum.</p>

<pre><code>enum
{
   FRONT,
   BACK
}
.
.
.
   if (frontOrBack == FRONT)
   {
      // Stuff
   }
   else if (frontOrBack == BACK)
   {
      // Some other stuff
   }
</code></pre>
 396: <p>Since you are using C strings (array of characters) instead of the C++ String class, you cannot use the == operator.</p>

<p>Instead, you can use the C style <a href="http://www.cplusplus.com/reference/cstring/strcmp/" rel="nofollow">strcmp</a> function, which is also part of the C++ library:</p>

<pre><code>    #include &lt;string.h&gt;
       .
       .
       .

    if (!strcmp(frontOrBack,"front")) {
        digitalWrite(frontEyes, LOW);}//end if   
    else if (!strcmp(frontOrBack,"back")) {
        digitalWrite(backEyes, LOW);}//end else*/
    } 
</code></pre>
