top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a Program to print source code as program output in C? [CLOSED]

+2 votes
441 views

Hello friends I am searching the Program to print source code as program output in C programming

posted Nov 12, 2016 by Naveen Kumar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Use this code, it is working for me.

#include <stdio.h>
int main()
{
   FILE *fp;
   char c;
   fp = fopen(\__FILE\__,"r");
   do {
      c = getc(fp);
      putchar(c);
   }
   while(c != EOF);
   fclose(fp);
   return 0;
}
answer Nov 12, 2016 by Ganesh
...