Add a main function which takes any number (including 0) of command line arguments. It creates a new array whose entries are the results of calling make_reverse below on the given arguments. It then prints the words of the new array, one per line. Finally, it frees any allocated memory. Add a Makefile so that typing make compiles the program into the executable reverse.exec, and typing make test runs 3 tests. Typing make clean should remove any generated files. Program: #include char * make_reverse(char * word){ int i, len=0; char temp; while(word[len]){ len++; } for(i=0; i
Add a main function which takes any number (including 0) of command line arguments. It creates
a new array whose entries are the results of calling make_reverse below on the given arguments. It then
prints the words of the new array, one per line. Finally, it frees any allocated memory.
Add a Makefile so that typing make compiles the
typing make test runs 3 tests. Typing make clean should remove any generated files.
Program:
#include <stdio.h>
char * make_reverse(char * word){
int i, len=0;
char temp;
while(word[len]){
len++;
}
for(i=0; i<len/2; ++i){
temp = word[i];
word[i]=word[len-i-1];
word[len-i-1]=temp;
}
return word;
}
i give this question answer in next step,
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images