|
Thanks to Wei Yen, Paul Dorfman, Harry Doogendyk, Richard Graham, Peter Crawford for their instant help. As a summary, I asked how to reverse a 1-byte character array with &N elements without using an additional intermediate array to hold the elements in the reverse order. The one-array solution adopted is to swap opposite elements and move towards center as offered by Paul Dorfman. Actually Paul went further and offered a zero-array (!) solution I would never even suspect could exist
data reverse;
set vset;
call poke(reverse(peekc(addr(v1),&n)),addr(v1),&n);
run;
Up until I saw this rather unusual code, I never thought that poke, peek and addr could be of any practical use whatsoever.
Thanks Max
_____________________________________________________________
Get Your Own .NU Web Address Now! ---> http://WWW.NUNAMES.NU
|