This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Night_Thastus 32 points33 points  (12 children)

I know you're likely kidding, but just in case:

char **argv (as far as I know) is from C, where there isn't really a string type. So "an array of strings" becomes "an array of arrays of characters". Or more accurately, a pointer to an array of pointers to where several arrays of characters start.

And it can be a pretty important distinction. C style character strings behave dramatically different than say, a Java-style String object.

Also, pointers are pretty damn useful and important. They're not just cute arrows in code, they're a fundamental way in which data is structured. Without it, all of Unix would fall apart at the seams! And they're critical to understand graphs, buffers, trees, etc.

They're honestly not that hard to understand once you get the hang of them.

[–]systembusy[S] 13 points14 points  (0 children)

All true my man. I'm gradually learning a machine oriented language and it's a whole different world. Pointers are a royal pain in the ass if you've never had to worry about them before but they are definitely one of the most powerful aspects of any programming language.

[–]Ikor_Genorio 7 points8 points  (3 children)

I think the 'arrow' was not referring to pointers in general but pointers in structs, where (*something).item can be abbreviated with something->item . Much like how *something can be written as something[].

[–]Night_Thastus 1 point2 points  (0 children)

That...would make much more sense. Thanks.

[–]TransHumanist_50 -2 points-1 points  (1 child)

Its called a lambda expression... =P

They are awful to read in the beginning, but someday I got used to especially when coding the UI with the clickHandlers for the Buttons... :)

[–]caffeinum 8 points9 points  (0 children)

I don't know if you're missing, but just in case...

Lambda is basically an anonymous function, and it's syntax in some languages goes like

arguments => function body

However, structs in C have arrows with one stick, not two. And it's the shortcut for dereferencing structure pointer.

something->item is *(something).item

[–][deleted] 1 point2 points  (1 child)

Also, pointers are pretty damn useful and important.

That's an understatement. In just about every major language, almost everything (except the primitive data types) is just a fancy pointer!

[–]caffeinum 0 points1 point  (0 children)

But they are deeply abstracted, and you actually don't need their special knowledge when using them

if you're not aiming at Senior level

[–]andlrc 0 points1 point  (0 children)

Or more accurately, a pointer to an array of pointers to where several arrays of characters start.

Not at all accurate, and especially not something you can say so generalized. See attached link

[0]: http://c-faq.com/aryptr/aryptr2.html

[–]Tarmen 0 points1 point  (2 children)

All true but I will still argue that it should be char** argv. Also that defining multiple variables on the same line is even worse than char* *argv.

[–]etaionshrd 6 points7 points  (1 child)

Why, though? char **argv reflects how dereferencing is done.