title: how to find length of an unsigned char pointer in C?
body: <p>I want to find size or length of an unsigned char pointer in a function where that pointer is an argument to that function.Near the pointers declaration size is coming correctly.</p>
  
  <p>But when i am trying to find size in function it is giving 4.</p>
  
  <p>How can i do this ?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  //void writeFile(unsigned char *da);
  void writeFile(char *da);
  int main(int arc,char **argv)
  {
  
   unsigned char block_bmp[]=
  {
     0x0,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,0xff,0x0,0x0,0x0,0xff,0xff,0xff,//*16bytes*
  };
  printf("size::%d\n",sizeof(block_bmp));
  writeFile(block_bmp);
  }
  
  //void writeFile(unsigned char *da)
  void writeFile(char *da)
  {
  printf("%d\n",__LINE__);
  printf("size::%d\n",sizeof(da));
  printf("length::%d\n",strlen(da));
  FILE *fp;
  int i;
  fp=fopen("/tmp/hexfile","wb");
  for(i=0;i&lt;3780;i++)
      fprintf(fp,"%c",da[i]); 
  //  fwrite(da,sizeof(unsigned char),sizeof(da),fp);
  fclose(fp);
  }
  </code></pre>