文字を文字列に出力する非常に単純なプログラムがありますが、何らかの理由で機能しません。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void * print_chars(char *process_string) {
int i;
int string_len;
string_len = strlen(process_string);
printf("String is %s, and its length is %d", process_string, string_len);
for(i = 0; i < string_len; i++) {
printf(process_string[i]);
}
printf("\n");
}
int main(void) {
char *process_string;
process_string = "This is the parent process.";
print_chars(process_string);
return 0;
}
Netbeansで実行すると、次のようになります。
RUN FAILED (exit value 1, total time: 98ms)
行を削除すると
printf(process_string[i]);
プログラムは実行されますが、コンソールには何も出力されません(明らかに)。
私がここで見逃しているアイデアはありますか?