|
|
|
|
|
by redthrowaway
5398 days ago
|
|
">,[>,]<[.<]" pStr++;
*pStr = getc(stdin); //or wherever
while *pStr {
pStr++;
*pStr = getc(stdin);
}
pStr--;
while *pStr {
putc (*pStr, stdout)
pStr--;
}
It'll print the reverse of a string, but it will also print everything before it until it hits a null byte. I'd add <[-]
to the beginning to null out the preceding byte and hope it wasn't important.As silly as brainfuck seems, I could see something like it being used in nanobots (should such a thing ever come to pass), where memory would be at a severe premium. |
|