Q2: Implelment the follwoing function ArrPrintMatrix(char *(p)[7]) which prints the content of the matrix[m][7] ={"SHAHBAZ","AYAZ"} in to 3x3 Matrix
Sample Output
S H A H B A Z A Y ..
My question is : here is code only problem i am getting is a space after one name is completed..how to remove that space . I have this question in my assignments , that have to be submitted on sunday (11-11-18).. My code is:
#include<stdio.h>
int main()
{
void ArrPrintMatrix(char *p);//function declaration
char matrix[2][8] ={"SHAHBAZ","AYAZ"};//2d array initiliation
ArrPrintMatrix(&matrix[0][0]);//calling function with base address
}
void ArrPrintMatrix(char *p)
{
int i;
for(i=0;i<16;i++)
{
if(i>=9)//since 3 by 3 matrix is required
break;
if(i==3||i==6||i==9)//changing line since 3 by 3 matrix is needed
printf("\n");
printf("%c ",*(p+i));//prininting chracters
}
}
ArrPrintMatrix(char *(p)[7])and gives you a string that's 8 characters long ("SHAHBAZ" plus a terminating zero).ArrPrintMatrix(char *(p)[7])and to pass it to function can you please please help me ....please