title: How do I receive a char array in a C function?
body: <p>I wish to split a "string" by the character ','.
  The string holds a GPS NMEA encoded string, but that is of no matter.</p>
  
  <p>My problem is that sometimes the parameter from the function that processes this char array is empty... Like nothing is in the array.</p>
  
  <p>How should I correctly pass a "char string[]" to a function so that I may operate on a that parameter as I sent it(as a char array, not a char pointer to an array). </p>
  
  <p>I also need to specify that I'm using mikroC for PIC.</p>
  
  <p>Here is my code as of right now:</p>
  
  <pre><code>char* GPS_sateliti;
  char CsatInView[] = 
  "$GPGSV,3,2,11,14,25,170,00,16,57,208,39,18,67,296,40,19,40,246,00*74";
  
  GPS_sateliti = GrupeazaDupaVirgule(CsatInView, 2);
  
  char* GrupeazaDupaVirgule( char deGasit[],int nrVirgule ){
      int cVirgule = 1;
      char* pch = strtok (deGasit,",");
  
      while (pch != 0)
      {
         pch = strtok (0, ",");
         cVirgule++;
         if(nrVirgule == cVirgule){
            break;
      }
  }
  return pch;
  }
  </code></pre>
  
  <p>The function that operates on the char array received as a parameter in debug mode, before entering the function the char array is fine, after entering it, it seems to be empty
  <a href="https://i.stack.imgur.com/sDfYx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sDfYx.png" alt="The function that operates on the char array received as a parameter in debug mode, before entering the function the char array is fine, after entering it, it seems to be empty "></a></p>
  
  <p>It may be that I should receive a pointer to an array of chars??
  Any sort of advice is welcome. 
  Thank you</p>