Question: I am trying to make a code in C (not C++) that reads in a series of words and prints them out backwards, but makes

I am trying to make a code in C (not C++) that reads in a series of words and prints them out backwards, but makes a new line after a set number of characters. This is my current code. Can someone help. I am lost as how to do this.

#include #include

int main(void){

int width = 0; int i; int a = 0; int j; int length; char array[30][30]; int block;

printf("Enter the output line length: "); scanf("%d", &width); block = width; printf("Enter your text (control-d to exit)."); scanf("%s", array[a]); while (!feof(stdin)){ a++; scanf("%s", array[a]); }

for (i=a-1; i>=0; i--){ for (j=width-1; j>=0; j--){ length = strlen(array[i]); if (lengthblock); printf(" "); block = width; } }

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!