sampai sini -->

04 January, 2010

C Prog - Program to Print it’s Own Source Code










Here is a C program to print it’s own source code.
That is the output of this program
is exactly same as it’s source code.
Here’s the program

#include
char *program=”#include%cchar *

program=%c%s%c;%cvoid main()%c{%cprintf
(program,10,34,program,34,10, 10,10,10);%c}”;
void main()
{
printf(program,10,34,program,34,10,10,10,10);
}
 

5 comments:

  1. #include
    main()
    {
    FILE *fp=fopen(__FILE__,”r”);
    char ch;
    printf(“Hello World\n”);
    while(!feof(fp))
    {
    ch=fgetc(fp);
    printf(“%c”,ch);
    }
    }

    This program also prints it out source code as output .

    ReplyDelete
  2. this is a great site which helped me a lot
    great work is done by u for learners of c Keep it up.

    ReplyDelete
  3. hello ,
    can u please mail me some game source codes

    ReplyDelete
  4. im newbie in c prog..
    still learning..

    ReplyDelete

YOUR NUMBER :

frontpage hit counter nasnur hit counter and User Online