。1の#include <stdio.hの> 2 。3 INTメイン(ボイド) 。4 { 5 INT I; 6 チャー STR [ 80 ]; 7 チャーCH、TEMP; 8 。9 CH = GETCHAR(); // 文字を見つける必要が 10 TEMPをGETCHAR =(); // 最初の改行 。11 12であり、 Iは、= 0 、 13であり 、一方(!(STR [I] = GETCHAR())= ' \ N- ' ) 14 { 15 I ++ 。 16 } 17 str[i] = '\0'; 18 19 int index = -1; 20 for (i = 0; str[i] != '\0'; i++) 21 { 22 if (str[i] == ch) 23 { 24 index = i; 25 } 26 } 27 28 if (index == -1) 29 { 30 printf("Not Found\n"); 31 } 32 else 33 { 34 printf("index = %d\n", index); 35 } 36 37 return 0; 38 }