Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Online GDB Show step by step how to have my code run with the three test cases with online GDB , because I do
Using Online GDB
Show step by step how to have my code run with the three test cases with online GDB because I do not get it
Use the code below!
Write a C program myprog that can accept an arbitrary number of command line arguments, eg
myprog Hello, world!
You are not allowed to use any standard string manipulation functions from
myprog must print each argument starting with the first character on the first line, two characters on the second line, etc. myprog must exclude all characters other than a through z and A through Z For the parameters specified above, myprog must produce the following output:
H
He
Hel
Hell
Hello
W
Wo
Wor
Worl
World
Use three test cases to verify the correctness of your code as follows:
myprog
myprog Have a nice day!
myprog paraskevidekatriaphobia Friday
#include
Step : Function to check if a character is an alphabet AZ or az
int isalphachar c
return c A && c Zc a && c z;
Step : Function to print filtered arguments
void printfilteredargumentsint argc, char argv
Iterate through each argument
for int i ; i argc; i
int len ;
Count the number of valid characters in the current argument
for int j ; argvij; j
if isalphaargvij
len;
Print the filtered argument line by line
for int k ; k len; k
int count ;
for int j ; argvij && count k; j
if isalphaargvij
printfc argvij;
count;
printf
;
Step : Main function
int mainint argc, char argv
Call the function to print filtered arguments
printfilteredargumentsargc argv;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started