title: How to compare arrays of char in CUDA C++?
body: <p>I need a function in cuda that recieves an array of chars and if they match, the function returns a value, but when i test this code, always return 0, like none of these conditions match. so far i tried this:</p>
  
  <pre><code>__device__   float operate_1(float num, char  func[]) {
  
          if(func[0] == 's' &amp;&amp; func[1] == 'i' &amp;&amp; func[2] == 'n'  )
  
              return sinf(num * PI/180.0);
  
          else if(func[0] == 'c' &amp;&amp; func[1] == 'o' &amp;&amp; func[2] == 's'  )
  
              return cosf(num * PI/180.0);
  
          else if(func[0] == 'l' &amp;&amp; func[1] == 'o' &amp;&amp; func[2] == 'g'  )
  
              return logf(num);
  
         else if(func[0] == 'e')
  
              return expf (num);
  
          return 0; }
          //evaluates an operator.
  </code></pre>
  
  <p>and this code too, but doesn't work like the previous one.</p>
  
  <pre><code>  __device__   float operate_1(float num, char  func[]) {
  
          if(func == "sin")
  
              return sinf(num * PI/180.0);
  
          else if(func == "cos")
  
              return cosf(num * PI/180.0);
  
          else if(func == "log")
  
              return logf(num);
  
         else if(func == "e")
  
              return expf (num);
  
          return -0; }
          //evaluates an operator.
  </code></pre>
  
  <p>what i can i do?</p>