倒著印字串1
user_3763047219
c_cpp
3 years ago
433 B
6
Indexable
#include <iostream>
#include <stdio.h>
#define _CRT_SECURE_NO_WARNING
#include <ctype.h>
#include <string.h>
#define ARRAYSIZE 100
#define STRINGLEN 80
int main()
{
char string[80] = "programing";
//中文字佔兩位元
int length = strlen(string);
printf("%d\t%c\n", length, string[length-1]);
//最後一位是空的\0
for (int i = length - 1; i >= 0; i--) {
printf("%c", string[i]);
}printf("\n");
}
Editor is loading...