Just started to delve into the world of C
after scripting for the past 6 months or so and with a background in visual basic
this syntax is weird as hell besides books, since I believe I have a few on digits, what are some good tips for someone just starting out on the language? |
Re: Just started to delve into the world of C
understand how to manipulate memory with constructs such as pointers. this is essential to understanding C and why it's useful over other languages.
EDIT: also, the language isn't designed to stop you from doing something dumb. this is for efficiency reasons. it's really easy to shoot yourself in the foot if you aren't careful. |
Re: Just started to delve into the world of C
are pointers a pretty C exclusive concept?
|
Re: Just started to delve into the world of C
for the most part pointer manipulation is only done in c/c++, yes. less so in c++ because of destructors.
|
Re: Just started to delve into the world of C
Having studied quite a few programming languages I think I can speak on this.
Practice practice practice. Look at similar examples, and when you get stuck on anything stackoverflow.com is your friend, as well as stackexchange.com in general, and of course, Google. Might also suggest to go back to slightly smaller code/programs than you are used to and build up when learning a new language. Both VB and C are primarily procedural languages, so at least you are in the same language family. That will simplify the learning process. Learning a (language in a) different programming language family can be confusing. I think back to when I first learned logical programming (in prolog). That was totally something else. But I digress... Going from VB to C I would say start by focusing on opening and closing your brackets instead of, for example, 'end while' of VB. Make sure you remember semicolons at the end of every statement, and above all remember that they are both capable of pretty much the same things, but each has its own syntax for doing so. Try to learn what the corresponding statements are, and then you will realize that just by knowing VB you are well on your way to learning C (despite the completely different syntax). I have found that the more (both programming and spoken/written) languages I learn, the easier it is to learn new ones, just by having a better understanding that they accomplish the same things (for the most part) in different ways. Oh, and I almost forgot cplusplus.com. C++ is a superset of C, which means everything in C is in C++. There will be C++ specific things on the site that do not apply to C, but for the most part it is an excellent C reference as well. And lastly ask me if you have any questions. I love C++ and C. Edit: and yeah, what Fission said about memory and pointers. There are safe and unsafe ways to allocate memory. C does not check if you use unsafe methods, so watch out for them. For example using malloc() without verifying the memory was allcated. |
Re: Just started to delve into the world of C
Quote:
|
Re: Just started to delve into the world of C
that'll happen later, I'm still getting shit on by semicolons
|
Re: Just started to delve into the world of C
Semicolons are ridiculously easy. Just put them at the end of everything (like periods in English).
|
Re: Just started to delve into the world of C
if you want to have all of the little semicolon-type syntax stuff drilled into your head forever:
use notepad++ or something similar if you don't care about that and just want to touch on the concepts and then maybe move on to a different language or something, which wouldn't make a ton of sense to me since you already know how to program: use eclipse or something similar |
Re: Just started to delve into the world of C
sublime text best text editor. eclipse is pretty gross for c/c++.
|
Re: Just started to delve into the world of C
yeah I know semicolons are easy but I'm not totally used to them yet
on my linux laptop, I'm using geany for my ide just got back to my desktop, I'm looking at CodeLite for ide compiler I'll stick with gcc |
Re: Just started to delve into the world of C
what I really meant to get at was, you can decide whether or not your IDE and whatnot will fix some of your mistakes for you. there are pros and cons to both.
|
Re: Just started to delve into the world of C
the nice thing about geany is that if I forgot a semicolon, it doesn't show up until I try to compile. perfect frustration level
|
All times are GMT -5. The time now is 07:36 PM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution