Showing posts with label code generator. Show all posts
Showing posts with label code generator. Show all posts

Saturday, May 18, 2013

Code Generator in C

The following code generates the code itself. The code seems to be simple but it's little bit tricky and is FAQ for programmers in an interview.




#include"stdio.h"
#include"conio.h"
char *s="#include%c#include%cchar *s=%c%s%c;%cvoid main()%c{%cclrscr();-%cprintf(s,10,10,34,s,34,10,10,10,10,10,10);%cgetch();%c}";
void main(){
//clrscr();
printf(s,10,10,34,s,34,10,10,10,10,10,10);
getch();
}