各位大佬,这个哪里错了啊????

P5705 【深基2.例7】数字反转

lidaga0420 @ 2023-07-13 20:44:59

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
using namespace std;
int main(){
    char a[1001]={};
    cin>>a;
    int z=strlen(a);
    for(int i=z;i>=0;i--){
        cout<<a[i];
    }
    return 0;
}

by _Haoomff_ @ 2023-07-13 20:45:55

@lidaga0420 for循环里改成i=z-1


by liuzikun___ @ 2023-07-13 20:46:05

@lidaga0420 i = z - 1


by YyOo @ 2023-07-25 20:10:31


#include <stdio.h>
#include <stdlib.h>

int main()
{
    char c[10];
    int i;
    scanf("%s",c); 
    for (i =10; i >= 0; i--)
    {
        printf("%c", c[i]);
    }
    return 0;
}

可以问问这个哪里出错了吗

|