P
Piotr S.
What's wrong in following program:
#include <stdio.h>
#include <stdlib.h>
char s[80];
int main()
{
FILE *fp, *fopen();
if(fp = fopen("plik1","r")== NULL)
{
printf("blad otwarcia"); exit(1);
}
else
{
printf("\notwarty\n");
while(fgets(s,30,fp)== NULL)
printf("%s\n",s);
}
}
I thought that buffor s is not properly declared, I had tried to declare
this variable
inside main(), and as char * s; Everytime runnig the program resulted in
segmentation fault.
#include <stdio.h>
#include <stdlib.h>
char s[80];
int main()
{
FILE *fp, *fopen();
if(fp = fopen("plik1","r")== NULL)
{
printf("blad otwarcia"); exit(1);
}
else
{
printf("\notwarty\n");
while(fgets(s,30,fp)== NULL)
printf("%s\n",s);
}
}
I thought that buffor s is not properly declared, I had tried to declare
this variable
inside main(), and as char * s; Everytime runnig the program resulted in
segmentation fault.