編寫一個程序把一個單詞讀入一個字符數組中,然後倒序打印這個單詞。提示:strlen()函數(第4章介紹過)可用於計算數組最後一個字符的下標。
#include <stdio.h>
int main(void){
int i,j;
char word[20];
scanf("%s",&word);
j = strlen(word);
for(i=j-1;i>=0;i--){
printf("%c",word[i]);
}
}
編寫一個程序把一個單詞讀入一個字符數組中,然後倒序打印這個單詞。提示:strlen()函數(第4章介紹過)可用於計算數組最後一個字符的下標。
#include <stdio.h>
int main(void){
int i,j;
char word[20];
scanf("%s",&word);
j = strlen(word);
for(i=j-1;i>=0;i--){
printf("%c",word[i]);
}
}
文件名稱:copy_system.c#include <unistd.h>#include <sys/stat.h>#include <fcntl.h