This simple c program compiles (but with errors I do not understand)
and creates an executable program file yet it refuses to run
(giving segmentation error core dumped):
#include <stdio.h>
credits()
{
printf('Welcome to rpdc_engine');
return 0;
}
int main(int argc, char **argv)
{
credits();
return 0;
}
Compiling in Geany gives
gcc -Wall -c "rpdc_engine.c" (in directory: /home/richard/Documents/RPD_Computing_Programming/RPD_Chess_programming/RPD_C_Chess_programming/rpdc_engine)
rpdc_engine.c: In function ‘credits’:
rpdc_engine.c:29:9: warning: character constant too long for its type [enabled by default]
rpdc_engine.c:29:2: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast [enabled by default]
In file included from rpdc_engine.c:25:0:
/usr/include/stdio.h:365:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
Compilation finished successfully.
[richard@lizzief17 rpdc_engine]$ ./rpdc_engine
Segmentation fault (core dumped)
What is the problem with this simple code? I am most grateful for helpful replies and I hope to learn from them!

New Topic/Question
Reply




MultiQuote






|