K
krishna_1980
Guest
seuraava koodi on antaa ajonaikainen virhe "Segmentation fault". Miksi?
char * str;
fp = fopen ( "f1.txt", "r");
fgets (str, 10, fp);
puts (str);
mutta seuraava koodi toimii ............................................ .....
char * str;
fp = fopen ( "f1.txt", "r");
fgets (str, 10, fp);
for (i = 0, i <10; i )
printf ( "% c", * (str i));
char * str;
fp = fopen ( "f1.txt", "r");
fgets (str, 10, fp);
puts (str);
mutta seuraava koodi toimii ............................................ .....
char * str;
fp = fopen ( "f1.txt", "r");
fgets (str, 10, fp);
for (i = 0, i <10; i )
printf ( "% c", * (str i));