r/code • u/bbtta85 • Jul 29 '16
Help Please Please help! Need code to announce our pregnancy to my programmer boyfriend... <3
Hi all, my boyfriend is a Senior Software Engineer... I just found out that we are expecting, and I'd love to break the news to him with a block of code! Trouble is, I don't code... Would you all help me write a small block of code to let him know he's going to be a daddy? TIA!
1.3k
Upvotes
View all comments
Show parent comment
1
u/bcgoss Sep 04 '16
A pointer is a reference to a memory address. It "points" to that byte and says 'this one'. In brainfuck when you use + or - you change the value of the memory you're pointing to. The period symbol is used to read the memory at the current pointer and interpret it as an ascii character to be printed on the screen.
The < and > symbols are used to switch the pointer you're working with. Your program starts off with pointer 0, and you can use > to switch to pointer 1, then do some stuff and use < to switch back to pointer 0. This is useful because you can make changes to Pointer 0 without affecting pointer 1. You can set one pointer to the ascii value of a symbol and the other to point to the letter m. That way you don't have to step the value of the pointer all the way down to 32 just to use a space.