🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1589

Re: Self-printing C program

#1589
From: Jeff Jenness
Date: Sun, 16 Sep 1990 22:01
20 lines
1127 bytes
In article <38724@unix.cis.pitt.edu> meyer@unix.cis.pitt.edu (Timothy S. Meyer) writes:
>
>Seems to me I saw a self-printing C program a few years back in CACM or
>Computer magazine, but I can't seem to find it.  Can anyone give me a
>reference for such a program?  (A self-printing program is one that 
>outputs a copy of its own text and is more of a recreational interest I
>think.)
>
>Any help will be appreciated.

Here is an example of what you are looking for:

char p[]="char p[]=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}

Hope this helps,

-- 
Jeff Jenness
University of Missouri - Rolla
jeffj@cs.umr.edu
Technical Details
Message-ID: <1400@umriscc.isc.umr.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!maverick.ksu.ksu.edu!umriscc!mcs213j.cs.umr.edu!jeffj
References: <38724@unix.cis.pitt.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!maverick.ksu.ksu.edu!umriscc!mcs213j.cs.umr.edu!jeffj
From: jeffj@mcs213j.cs.umr.edu (Jeff Jenness)
Newsgroups: comp.lang.misc,comp.lang.c
Subject: Re: Self-printing C program
Summary: Self reproducing C program
Message-ID: <1400@umriscc.isc.umr.edu>
Date: 16 Sep 90 22:01:48 GMT
References: <38724@unix.cis.pitt.edu>
Sender: news@umriscc.isc.umr.edu
Followup-To: comp.lang.misc
Organization: University of Missouri - Rolla
Lines: 20