Write a C Program to Display its own Source Code as Output Hindi

C Program which displays its own source code as its output-

सुनने मे ये program थोड़ा बहुत complex लगता है लेकिन इस program का concept बहुत simple है |

Display its own Source Code as Output c Program

Display its own Source Code as Output c Program

#include

int main()  {

FILE *fp;

char ch;

fp = fopen(__FILE__,”r”);

do {

ch = getc(fp);

putchar(ch);

}

while (ch != EOF);

fclose(fp);

return 0;
}

इस प्रोग्राम मे predefined macro __FILE__ C programming की current फाइल की location को string मे रखता है |

No Responses

Leave a Reply