ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Why the insistence on all the *'s and &'s and ->'s ?
2) Header files
I don't understand the practise of defining a class with empty methods and such like in a .h file and then seeming to basically overwrite them in the .c with ...
aClass::aMethod() { ... }
I can understand how a header file can set out things in a presentable and approachable manner... but the whole :: thing... I can't see why that isn't really bad practise.
getting a firm understanding of pointers is probably the most difficult thing for anyone learning C or C++. personally, i agree with you about the :: notation. it's damn annoying in my book.
trust me tho, you'll learn to love pointers (pause here for anyone who wants to burst out laughing)... they are probably the biggest reason why C is as successful as it is, and as fast. once you learn how to use them, you'll wonder how you ever did without them.
if you need any specific explanation of pointers, let me know. i'll see what i can do to help.
Header files allow you to publish your API (for you and the compiler) and hide the implementation (.c and .cpp files) in a pre-complied library.
Pick the function 'stat' as an example. From the header file you can see the method signature, and you can complile against it so the complier know that it exists. Come link time you link in the lib???.a file and wala. stat works without you knowing any details of how it works.
Uhhh. So. Um, no pun intended, but do you have any pointers for pointers? Like some links, mebbe? The subject has led me to abandon C every time I get to it. But reality dictates that there is only so much one can accomplish with #!/bin/bash, and playing with perl was fun until I got to the part about "pointers, just like the ones C programmers use".
the basic concept of pointers isn't hard to understand at all - i think it's the syntax that weeds out most would-be-c-programmers.
trust me tho, a forum is not really the place to learn about pointers. if you have specific questions, then ask away, but don't ask for a generic pointer primer
Yes you can have pointers to pointers. The only reason I have seen this done is for dynamic arrays. You declare it as "<type>** <variable>;" Dynamic arrays can be quite useful in some situations.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.