Program to print its own source code

#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;
}

Share this

Related Posts

Dear User,

Thank you for your comment. Hope you like this blog. Kindly share us on Social Media so others can be updated.

-Chief Administrative Officer.