PROGRAM TO BE WRITTEN IN C }Ch.11 PE 13 (ENHANCED) Write a program that echoes t
ID: 3767115 • Letter: P
Question
PROGRAM TO BE WRITTEN IN C
}Ch.11 PE 13 (ENHANCED) Write a program that echoes the command-line arguments in reverse order. Name the project and the program something short, like rev, to save yourself lots of command-line typing. Note that you will have to:
} a) build your program (F7)
} b) copy the .exe file from your project folder (My DocumentsVisual studio 2010 evDebug to C:usersyourname
} c) and run the .exe file from the DOS Command Prompt, assuming the Command Prompt opens to C:usersyourname.
}The program should NOT prompt the user at all. Example runs of the program (go to Start…All Programs…Accessories… Command Prompt) with computer output shown underlined:
}
}C:Usersmatkins> rev This is a test
}test a is This
}
}C:Usersmatkins> rev don’t print this in reverse
}Reverse in this print don’t
please write the program and explain what you did thank you
Explanation / Answer
#include <stdio.h>
int main(int argc, char* argv[])
{
int i;
for(i = argc - 1; i > 0; i--) printf("%s ", argv[i]);
printf(" ");
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.