最初:私はポインターの初心者です。
ポインター配列の文字列の文字を出力したいだけです。それは正常に動作しますが、Eclipse Juno (Mac OS X) で 2 つの問題が発生し
ます
。
#include<stdio.h>
#include<string.h>
int main(void)
{
char *words[] = {"word1", "word2", "word3", "word4", "word5"};
char *tempWord,*tempChar;
int i, j, numElems2;
int numElems = sizeof words / sizeof words[0];
for(i = 0; i < numElems; ++i)
{
tempWord = words[i];
numElems2 = strlen(tempWord);
for(j = 0; j < numElems2; ++j)
{
tempChar = tempWord[j];
printf("%c", tempChar);
}
printf("\n");
}
return 0;
}
I understand the first problem, but don't know how to solve it. The second problem I don't understand. What has a 'char' to do with 'int'?
Maybe there is somebody who can give me some advice. Thanks.