Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write C program that reads a string from the keyboard into a into a character ar

ID: 3700495 • Letter: W

Question

Write C program that reads a string from the keyboard into a into a character array, and prints the letters of that sting opposite separated by space. For example, when you input “ Steve”, the output “ e v e t s”
Note: use Arrays Write C program that reads a string from the keyboard into a into a character array, and prints the letters of that sting opposite separated by space. For example, when you input “ Steve”, the output “ e v e t s”
Note: use Arrays For example, when you input “ Steve”, the output “ e v e t s”
Note: use Arrays

Explanation / Answer

// CPP program to reverse a

// given string using

// strlen()

#include<stdio.h>

#include<string.h>

// Function to reverse a string

void * reverse(char * str )

{

int i, len ;

// calculating length of the string

len = strlen(str);

for( i=len ; i>=0 ; i--)

// *(str+i) is the character at the ith index

// of the string

printf( "%c ", *(str+i));

}

// Driver code

int main( void )

{

char a[] = "Hello Steve" ;

printf("Enter A String ");

scanf("%s",a);

reverse(a);

return(0);

}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote