Peter J Ruczynski.
Pyramid Technology Ltd.
Hants GU14 7PL
This program prints out a string. Can you figure out how it is done?
By use of pointers to functions returning a struct of pointers to functions!
Note that some compilers will be unable to compile the expression ‘X=g()…’ in main due to lack of temporary value space. One might want to try replacing main with:
if this is a problem.
Spoiler: (rot13 to read)
Guvf cebtenz cevagf bhg gur fgevat: gur dhvpx oebja sbk whzcrq bire gur ynml qbt ol hfr bs cbvagref gb shapgvbaf ergheavat n fgehpg bs cbvagref gb shapgvbaf!
Selected notes from the author: (rot13 to read)
Vg vf fvzcyr gb znxr gur cebtenz cevag bgure fgevatf. Rnpu nycunorgvpny punenpgre sebz n gb m vf cevagrq bhg nf vgf bccbfvgr: n->m o->l p->k rgp Gb rapbqr n arj fgevat vachg gur fgevat nf vg vf zrnag gb pbzr bhg: K=f().i().b().b().y().F().q().y().v().b().j().A(); Abgr: F() ercerfragf n fcnpr naq A() n arjyvar. Guvf jvyy abj cebqhpr... uryyb jbeyq
By the way, there is actually a piece of code which is not used in the original program! I leave it as an intellectual exercise to the reader to find out what it is.
Copyright © 1990, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is granted provided this this copyright and notice are included in its entirety and remains unaltered. All other uses must receive prior permission in writing from both Landon Curt Noll and Larry Bassel.