字符串的逆序存放(c語言)

分析:字符串逆序存放也就是字符數組的倒置,只要循環交換數組的開頭和結尾便可。數組 代碼以下:code #include <stdio.h> #include <string.h> int main(){ char str[50]; scanf("%s",str); int len = strlen(str); int top=0,end = len-1; //定義兩個變量指向開頭和末尾
相關文章
相關標籤/搜索