in test function the for loop work fine but printf(num[0])is getting 0. does any one know why?

int main(void)
{
 char num[20];
    num[0] = '3';
    num[1] = 'a';
 
 void test(num);
}
 
 void test(char num[])
{
 for(a = 0; a < 20; a++) 
 {
  printf("%c",num);
 }

 printf("%c",num[0]);
}

See my answer to your other question...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.