Write a statement that calls the recursive function BackwardsAlphabet() with par
ID: 643595 • Letter: W
Question
Write a statement that calls the recursive function BackwardsAlphabet() with parameter startingLetter.
#include <stdio.h>
void BackwardsAlphabet(char currLetter){
if (currLetter == 'a') {
printf("%c ", currLetter);
}
else{
printf("%c ", currLetter);
BackwardsAlphabet(currLetter - 1);
}
return;
}
int main(void) {
char startingLetter = '-';
startingLetter = 'z';
/* Your solution goes here */
return 0;
}
Write a statement that calls the recursive function BackwardsAlphabet() with parameter startingLetter.
Explanation / Answer
The complete code is:
#include <stdio.h>
void BackwardsAlphabet(char currLetter){
if (currLetter == 'a') {
printf("%c ", currLetter);
}
else{
printf("%c ", currLetter);
BackwardsAlphabet(currLetter - 1);
}
return;
}
int main(void) {
char startingLetter = '-';
startingLetter = 'z';
BackwardsAlphabet(startingLetter);
return 0;
}
Output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.