+ 2
Problem in Output
https://code.sololearn.com/c0kDHXg5Ggjw/?ref=app How would I know how many strings I entered(two-dimensional strings)? But definitely I entered less than what I allocated memory for!
9 odpowiedzi
+ 1
char p[20][50] = {0}; <== do this.
int i,j, len;
for(i=0;i<20;i++)
scanf("%s",p[i]);
for(i=0; p[i][0]; i++)
{
len = strlen(p[i]);
for(j=1; j < len; j++)
printf("%c", p[i][j]);
printf("%cay ", p[i][0]);
}
+ 6
SAAMBRAM AKSHAY KUMAR REDDY
Change char p[10][10] to char p[20][50]
+ 4
char p[10][13];
Is all that is needed to pass and stop your overflow issue.
+ 2
What is your input and what error or what is the exact output you want?
+ 2
Input: nevermind youve got them
Expected Output: evermindnay ouveyay otgay hemtay
Output by program: evermindnay ouveyay otgay hemtay (printing some unusual letters, symbols,etc)
My program is also executing the string which I have not assigned!
I need to overcome that!
+ 2
for(i=0; p[i][0]; i++)
{
len=strlen(p[i]);
for(j=1;j<len;j++)
printf("%c",p[i][j]);
printf("%cay ",p[i][0]);
}
+ 1
Still the output is giving some unusual symbols at 4,8,9,10 no. of strings!
+ 1
I've just run your amended code with 11 words and it work fine.
Copy and paste the output you're getting.
+ 1
sorry..post deleted...didn't work as expected.