I read some code examples and they returned const int. When I tried to compile the sample code, I got errors regarding conflicting return types. So I started looking, thinking that the problem with const was a problem (when I deleted it, the code worked fine, it not only compiled, but also worked as expected). But I could never find information specifically related to the type of constant return (I did for structures / parameters / etc. Etc., But I did not return types). So I tried writing a piece of code to just show what const can do. I came up with this:
#include <stdio.h>
int main() {
printf("%i", method());
}
const int method() {
return 5;
}
And when I compile this, I get:
$ gcc first.c
first.c:7: error: conflicting types for ‘method’
first.c:4: note: previous implicit declaration of ‘method’ was here
, , const, , , 5, . , - , const, . .