I know the rules of unix but now I do not follow them as it is deprived of a phone instead of a computer.
Code:
#include <stdio.h>
const void f_write()
{
FILE *f;
char Text[]="Test\n";
if ((f = fopen("text.txt","a")) == NULL)
printf("Error\n");
else
fwrite(Text, 5, 1, f);
fclose(f);
}
int main()
{
f_write();
}
This code still generates warnings:
test.c:3:12: warning: function definition has qualified void return type
const void f_write()
^
test.c: In function ‘main’:
test.c:16:2: warning: function with qualified void return type called
f_write();
^
Code:
#include <stdio.h>
const void f_write(FILE *f)
{
char Text[]="Test\n";
if ((f = fopen("text.txt","a")) == NULL)
printf("Error\n");
else
fwrite(Text, 5, 1, f);
}
int main()
{
FILE *f;
f_write(f);
fclose(f);
}
This program produces the same warnings but works fine too. Therefore, the problem in const