i have 1d Array and i have to copy in 2D Array like this
sDaysInMth[0] 31
sDaysInMth[1] 28
sDaysInMth[2] 31
sDaysInMth[3] 30
sDaysInMth[4] 31
sDaysInMth[5] 30
sDaysInMth[6] 31
sDaysInMth[7] 31
sDaysInMth[8] 30
sDaysInMth[9] 31
sDaysInMth[10] 30
sDaysInMth[11] 31
but Having problem in this code? i am not able to get correct answer.
static char pvtsWsMthDayTab[24]="312831303130313130313031";
char sDaysInMth[12][2] ;
static char pvtsWsNbrDyMth[3]="";
int i=0 , j = 0 ;
memset(pvtsWsNbrDyMth,'\0', sizeof(pvtsWsNbrDyMth));
memset(sDaysInMth, '\0', sizeof(sDaysInMth));
for(i=0; i< 12; i++)
{
memcpy(sDaysInMth[i], pvtsWsMthDayTab+(i*2), 2);
}
for(i=0;i<12;i++)
{
printf("%s ",sDaysInMth[i]); /* printing 2D array*/
printf("\n");
}