Question
//done in C please Write a program that reads from the user some text in a string str that can hold a maximum of 40
//done in C please
Write a program that reads from the user some text in a string str that can hold a maximum of 40 characters and then it splits the string into two other strings as follows: all the even-position characters are copied into a string called even and all the odd-position characters are copied into a string called odd. The program should then print out the even and odd strings. Your program should use char * variables (pointer to char) to traverse the strings str, even and odd .
The program should behave as follows (items in italics are entered by the user):
Enter a string (40 characters maximum): abcdefg
The even string is: aceg
The odd string is: bdf
Write a program that reads from the user some text in a string str that can hold a maximum of 40 characters and then it splits the string into two other strings as follows: all the even-position characters are copied into a string called even and all the odd-position characters are copied into a string called odd. The program should then print out the even and odd strings. Your program should use char * variables (pointer to char) to traverse the strings str, even and odd. The program should behave as follows (items underlined are entered by the user) Enter a string (40 characters maximum): abcdefg The even string is: aceg The odd string is: bdfStep 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