Flash Flash Revolution

Flash Flash Revolution (http://www.flashflashrevolution.com/vbz/index.php)
-   Technology (http://www.flashflashrevolution.com/vbz/forumdisplay.php?f=74)
-   -   Just started to delve into the world of C (http://www.flashflashrevolution.com/vbz/showthread.php?t=134658)

choof 01-11-2014 05:36 PM

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?

Fission 01-11-2014 05:41 PM

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.

choof 01-11-2014 05:44 PM

Re: Just started to delve into the world of C
 
are pointers a pretty C exclusive concept?

Fission 01-11-2014 05:46 PM

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.

ryuyasha 01-11-2014 05:58 PM

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.

qqwref 01-11-2014 07:06 PM

Re: Just started to delve into the world of C
 
Quote:

Originally Posted by choof (Post 4058341)
are pointers a pretty C exclusive concept?

Pointers are everywhere - they're just hidden from the programmer in most higher-level languages. Even in very high-level languages like Python, understanding how pointers work will give you a much better understanding of what actually happens when you move data around or pass variables to a function.

choof 01-11-2014 07:47 PM

Re: Just started to delve into the world of C
 
that'll happen later, I'm still getting shit on by semicolons

qqwref 01-11-2014 08:10 PM

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).

dAnceguy117 01-11-2014 08:20 PM

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

Fission 01-11-2014 08:26 PM

Re: Just started to delve into the world of C
 
sublime text best text editor. eclipse is pretty gross for c/c++.

choof 01-11-2014 08:59 PM

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

dAnceguy117 01-11-2014 09:01 PM

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.

choof 01-11-2014 09:03 PM

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