Need help with my program related to the string

Hi, how reverse strings?
For example:
"Esse eh um programa simples"
"etse amargorp he selpmis"

Look my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdlib.h>

int main()
{
    char vet[50];
    int i, n;
    printf("Digite uma frase ae: ");
    gets(vet);
    n = strlen(vet);

    for(i = n; i >= 0; i--){
        printf("%c", vet[i]);
    }

    printf("\n\n");
    system("pause");
    return 0;
}
Last edited on
Your program appears to work.
Did you have a specific question?

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
closed account (48T7M4Gy)
1
2
3
7:35: error: 'printf' was not declared in this scope
 8:13: error: 'gets' was not declared in this scope 
9:19: error: 'strlen' was not declared in this scope


You are missing #include < ... > statements relevant to the functions named at the lines in the error report
Topic archived. No new replies allowed.