r/ProgrammerHumor • u/AsidK • Feb 23 '14
punny stack overflow response
http://imgur.com/UbYvn6z7
Feb 24 '14
I don't get this pointer joke, can you explain de reference?
3
Feb 25 '14
I can point you in the right direction, in Objective C (what I assume this is) you need a * as a pointer when defining a variable. Example: NSString *helloThere = @"Hey!";
3
-5
-3
0
Feb 23 '14
[deleted]
18
u/AsidK Feb 23 '14
Yes, in most C based or similar languages, when you put a * after a type it makes it a pointer
0
u/MarekRules Feb 24 '14
I sure do hate pointers.
5
u/AsidK Feb 24 '14
What is your language of choice?
5
Feb 24 '14
ASM.
1
u/MarekRules Feb 24 '14
shudder I'll stick to my C# and Javascript. I still have nightmares from Operating Systems class and using pointers to pointers, and later arrays of pointers. For some reason in C, they just confuse the shit out of me.
3
u/tuseroni Feb 24 '14
pointers are great when you get used to them, until then it's just putting in combinations of "*" and "&" until it fucking compiles.
2
u/MarekRules Feb 24 '14
That's exactly what I tell people learning JavaScript and JQuery. "Just use a combination of $ signs until it doesn't blow up and then debug line by line from there."
2
u/kqr Feb 24 '14
Low-level languages have the concept of a pointer, which is a variable that do not contain the value you want – it contains the memory address of the value you want. So instead of being like a box with the letter C in it, it is a box with a piece of paper that says in which box you can find the letter C.
The concept of a pointer (or a reference or an access type, roughly the same thing but different names) is useful in languages which have no automatic memory management, because such languages may require you to manually keep track of in which memory addresses you have stored stuff.
In popular low-level languages such as C, saying
char igives you a variable that can store a character, and sayingchar *igives you a pointer that can contain an address to a memory location where a character is stored.
12
u/Galaxymac Feb 24 '14
Relevant XKCD.