Sometimes, it is necessary to print some message on logic failure or anytime with the function name and line number, so that program can be debugged and fixed the issue.
float devide(int a, int b)
result = (float)a/(float)b;
printf("Error at line %d in function "%s"\n",((__LINE__)-3),__func__);
//ERROR at 3 lines above: ((__LINE__)-3)
Error at line 9 in function "devide"
total answers (1)
start bookmarking useful questions and collections and save it into your
own study-lists, login now to start creating your own collections.