You should have a condition which should evaluate to true or false in order for an if
statement to work. I don't understand how p=fopen("test.txt", "r")
part of the following code evaluates to true or false since it only contains an assignment operator =
and not a ==
operator.
int main()
{
FILE *p;
if(p=fopen("test.txt","r"))
{
printf("yes\n");
}
else
printf("no\n");
return 0;```
Aucun commentaire:
Enregistrer un commentaire