When i compile this code it does create a sprintf.obj and a sprintf.exe files and it works, but it also says:
sprintf.c(19): warning C4047: 'function': 'char *const ' is different from 'char *[50]' in the indirect reference levels
sprintf.c(19): warning C4024: 'sprintf': different types between the formal parameter 1 and the actual one
sprintf.c(20): warning C4047: 'function': 'const char *' is different from 'char *[50]' in the indirect reference levels
sprintf.c(20): warning C4024: 'puts': different types between the formal parameter 1 and the actual one
As i said the program works fine, but i would like to know what is wrong.
i've used the developer commands prompt by visual studio 2015 to compile the code.
[Error] cannot convert 'char**' to 'char*' for argument '1' to 'int sprintf(char*, const char*, ...)'
[Error] cannot convert 'char**' to 'const char*' for argument '1' to 'int puts(const char*)'
The problem is that the first parameter of sprintf(), and that of puts() should be an array of characters (strictly, it is a pointer to char rather than an array). Your parameter formal is an array of pointers to char.
Do you know a good paper book for C++? because i ve found "C primer plus" which is considered one of the best for learning the basics of C, but i have no idea how different is C from C++ and since i need to learn C++ i would like to buy a good paper book.