sprintf
is for creating a string based on some formatting. It looks like you want output, so you want to use printf
.
Also, return 0;
should not be be enclosed in your for
loop. It would result in termination of the program after one iteration.
manpreet
Best Answer
2 years ago
I've undertaken learning c with the aid of the k & r book. Pretty exciting but I've run into trouble early on and I'm not sure how to fix the problem.
I'm trying out some really simple sample code and I'm getting the following error. I don't understand why because the code is straight out of the book.
I'd appreciate a nudge to get me going on my way again.