文字列の配列を表示するプログラム
#include <stdio.h> /*--- 配列として実現した文字列を表示 ---*/ void put_strary(const char st[][6], int n) { int i; for (i = 0; i < n; i++) printf("st[%d]=\"%s\"\n", i, st[i]); } int main(void) { char cs[][6] = {"LISP", "Ada", "C++"}; put_strary(cs, 3); return (0); }
実行結果
str=SEC 文字列strを逆順に並べ替えました。 str=CES