Programming
why I am getting presesntation error?

Question Description

I’m working on a Programming exercise and need support.

#include<stdio.h>
#include<string.h>
int main()
{
  char a[10000],ar[100][10000];
  int i,j,k,m,n,l,len[10000],c;
  freopen("input.txt","r",stdin);
  while(gets(a))
  {
  k=0;
  i=0;
  c=0;
  for(j=0; ; ++k)
  {
  if(a[k]==' ' || a[k]=='\0')
  {
  ar[i][j]='\0';
  len[i]=c;
  if(a[k]=='\0') break;
  i++;
  j=0;
  c=0;
  }
  else
  {
  ar[i][j]=a[k];
  c++;
  j++;
  }
  }
  for(m=0; m<=i; m++)
  {
  for(n=(len[m]-1); n>=0; n--)
  {
  printf("%c",ar[m][n]);
  }
  printf(" ");
  }
  printf("\n");
  }
  return 0;
}
here above i have submitted my code?

I am getting presentation error.

I want to know the reason.

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

Can you post the contents of the file "input.txt" ? And what error are you getting exactly ?

fixit (96)
UC Berkeley

Anonymous
Thanks for the help.

Anonymous
Outstanding. Studypool always delivers quality work.

Anonymous
Tutor was very helpful and took the time to explain concepts to me. Very responsive, managed to get replies within the hour.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4