Hacker News new | ask | show | jobs
by user2994cb 1616 days ago
If you don't like those hard-coded character constants, lack of newlines, and compiler warnings, here's a C quine on similar lines:

  #include<stdio.h>
  int main(){
    char q='"',n='\n',b='\\';
    char*f="#include<stdio.h>%cint main(){%c  char q='%c',n='%cn',b='%c%c';%c  char*f=%c%s%c;%c  printf(f,n,n,q,b,b,b,n,q,f,q,n,n,n);%c}%c";
    printf(f,n,n,q,b,b,b,n,q,f,q,n,n,n);
  }