Please suggest me how to display the line number in C program. without using predefined macros, or windows library files.
In Pelles C it's under the Source pull down menu, then select "view line numbers".
Check around your IDE editor options, also. Not every IDE editor has this, for an option.
sorry.....i don't want to see line numbers in editior........i want the line number to be displayed on output..........like we get in assert funtion...
without using predefined macros
What is with you people asking a question and then immediately rejecting the best solution? What do you think the __LINE__ macro was designed for?
When you compile the source code, everything gets translated to machine code, and everything ends up being referenced by a memory address. In addition, the compiler will likely optimize your code, and will not maintain any 1 to 1 relation to the source code. The idea of a line number is lost by this point. It may be possible to use a debug file (such as a PDB file from VisualC++) to achieve this, but that would not be a trivial task.