[comp.lang.c] Recursive macros

kochhar@harvard.harvard.EDU (Sandeep) (03/07/91)

hi!
The man page for cpp on my sun 4 says that the -R flag allows
the definition of recursive macros.
I have two questions regarding this:

1. Can someone send me an example of how such a macro works, especially
how the termination condition works?

2. Can this be used to define a macro, say FOO(a, n) which works as:	
	FOO(a, 1) expands to 	a
	FOO(a, 2) expands to    a * a
	FOO(a, 3) expands to    a * a * a

	etc.

Reply by e-mail preferable, since I'm not a regular reader.
Thanks in advance for any help.

-- 

Sandeep Kochhar
Harvard University              email: kochhar@endor.harvard.edu
33 Oxford st,                   tel:   (617) 495-3988            
Cambridge, MA 02138             fax:   (617) 495-9837