C program to display its own source code as its output | My CS Tutorial - My CS Tutorial

Breaking

Programming languages full tutorial and programs, exam papers, visual basic( Vb.net ), information of new technologies and more....

Saturday, February 22, 2020

C program to display its own source code as its output | My CS Tutorial





C PROGRAM CODE



#include<stdio.h>
#include<conio.h>
int main()
{
   FILE *file;
   char c;
   file = fopen(__FILE__,"r");
   do
   {
     c = getc(file);
     printf("%c",c);
   }
   while (c != EOF);
   fclose(file);
   printf("\n");
   return 0;
}



OUTPUT:





Please share this post and blog link with your friends.For more programs use this blog.
If you have any problem, please comment in comment box, subscribe this blog for notifications of new post on your email and follow this blog.If you have any method of this program or want to give any suggestion send email on hc78326@gmail.com

Created by-- HARSH CHAUHAN


No comments:

Post a Comment