Use #line to set line number - C Preprocessor

C examples for Preprocessor:Preprocessor Operators

Introduction

The following code sets that the line count will begin with 100.

Demo Code


#include <stdio.h>

#line 100              /* reset the line counter */
int main(void)         /* line 100 */
{                      /* line 101 */
   printf("%d\n", __LINE__); /* line 102 */

   return 0;/* w  ww  . j  a  v  a  2  s.co  m*/
}

Result


Related Tutorials