its c string not string

chapter ten
then
programming challenge
1
three
and four




take a pointer of a c string and return the length
take a pointer and display the content backwards



include <cstring>
include <iostream>

using namespace std;

void reverse (char *strx, int sze)
{
//loop through array backward and print each character
for (int size-1 x>=0; x--)
cout<<strx[x]

}
//define array
int main(){
const int legth =30;
char name[length];
//prompt for string
cout "enter a string";
cin.getline(name, length);
//pass its length and the array as params to function
reverse (name,strlen(name));
int fred;
cin>> fred;
}

Popular posts from this blog

ch11 review silberschatz operating systems concepts essentials 2nd ed