You are not logged in.

#1 2008-12-04 09:33:24

tcoffeep
Member
From: Timmins, Ontario
Registered: 2008-11-26
Posts: 99

Learning C

Hello.

I've looked and looked for answers to my question, but couldn't find one suitable for myself. Allow me to explain briefly :

I'm 21 years old, and currently without work. I dropped out of high school during my first year, and am currently unable to get into the college for my GED. This means, I do not have math skills beyond a normal eight-grader, unfortunately. I spend my time doing what I can to learn new things. I've been trying to learn to program, but I want a base before I begin actual coding. Now, my question is this :

1 ) what sort of math should I learn? ( every time i've looked for the answer to this question, I've seen people point out algorithms, discrete mathematics, et cetera. While I plan on learning these in the future, I figure I'm going to need to strengthen my algebraic knowledge.)

2 ) Are there any free guides for these that would suit my level? ( because of me being in-between jobs, I'm unable to afford texts ).

3 ) I tried to read K&R, but, found myself lost eventually. Is there a more newbie-friendly C text or guide that might be able to help me more?

Thanks, ahead of time. I'm sorry if this question has been asked a trillion times before.

BDKL


=============== Read An Essay ===============
   Distro : Funtoo Linux || Kernel : ckernel-2.6.30-gentoo-r5
Processor : Athlon 64 X2 4400+ || RAM : 2GB || HD : 300GB
========================================

Offline

#2 2008-12-04 10:38:47

deej
Member
Registered: 2008-02-08
Posts: 395

Re: Learning C

Here's something which may help you. Just copy and paste this into a file:

 <!-- Custom Google Search Form-->

<form method="get" action="http://www.google.com/search">

<input type="text" name="q" size=31 maxlength=255 value="">

<br />
Search site:
<select name="hq">
</select>
<input type="hidden" name="hq" value="intitle:index.of pdf">
<input type="hidden" name="num" value="100">

<input type="submit" value="Search Sid's Ebook Finder">

</form>

<!-- Custom Google Search Form-->

Name the file <whateveryouwant>.html.
This is a custom ebook search tool, created by Sid. Had it for a long time, so
Sid, wherever you are, thanks smile just type in C programming or Basic Maths  or
anything you want and it'll bring up a list of sites with the relevant e-books.

Hope it helps.

Deej

[Edit] Adjusted typo.

Last edited by deej (2008-12-04 10:39:20)

Offline

#3 2008-12-04 11:56:43

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: Learning C

,

Last edited by fumbles (2020-09-24 13:02:29)

Offline

#4 2008-12-04 14:11:59

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: Learning C

You don't need to know any kind of math to start programming.

Programming is just like writing a recipe (than then gets executed by a computer); in C, you have to be quite specific and detailed in your recipe: you can't expect the computer to be smart. Your computer doesn't understand math really; the only things it can do is very basic arithmetic and moving bits of memory around from one place to another. There's no reason you should understand math to program.

I half-learned C with a very bad "for dummies" book when I was in grade 8, and refined from web pages and man pages and reading code here and there. Try this maybe http://en.wikibooks.org/wiki/C_Programming?

Edit: Math is awesome and useful; but don't let your small knowledge of it stop you from starting to hack right away.

Last edited by peets (2008-12-04 16:06:42)

Offline

#5 2008-12-04 14:16:09

xen
Member
Registered: 2008-08-17
Posts: 56

Re: Learning C

If you ever intend to work with games, or other 3D applications you should get up to scratch on your 3D math skills. Now personally, I'm not very good at maths at all, but I find it so much easier to understand if I write programs that do the math theories, because by breaking it down into steps I can see what is actually happening, plus you can print the values of variables at any time to see whats going on smile

My advice to you, is to get comfortable with a language (Java is often learned first these days) and try and learn some math theory by writing simple programs.


A wannabe game-developer.
My Blog
My GitHub

Offline

#6 2008-12-04 14:27:32

string
Member
Registered: 2008-11-03
Posts: 286

Re: Learning C

I'm 21 years old myself (today is my birthday btw -- so happy birthday to me!).

1. Math is hella cool, not boring.
2. Math is a good way to exercise your mind (which is a Good thing) and an exercised mind can come in handy for a programmer. Alas: LogicSkills++;
3. K&R is "the bomb". Should you turn to easier material for now, here's my advice: when you think you're ready, try K&R again.

Good luck.

Last edited by string (2008-12-04 14:31:27)

Offline

#7 2008-12-04 16:24:48

cerbie
Member
Registered: 2008-03-16
Posts: 124

Re: Learning C

0) Can't get into college for your GED? Hmm? A community college won't take your money? If not, what about scholarship options? What about other methods of getting accepted (FI, my home school didn't want to play nice, but I got admitted by my SAT score--I was in for two years before they got proof I'd graduated HS)? If you're not able to learn everything needed in a DIY setting, school is a must. Lectures, stupid questions, homework, and tests work. Also, try to find profs who actually like the math they teach, if you can. I only have a AS in CS, entirely due to costs, so don't take it as, "oh, anyone can go to college and make it," but do try to look for non-standard ways in, and scholarships. While you'd likely still have to get a job to pay for a good bit, you may find scholarships available just for people like you, that HS graduates, or people in higher economic standing wouldn't qualify for (yes, there are folks with money that realize not all people failed by the system are dumb). Also, see what can be accepted for courses, or ways to bypass the requirements (IE, a test to take, then try to learn that stuff on your own time on first failure, or something). You may have options to complete HS maths and such late on a tight budget in your community (sometimes vocational/tech schools have such classes on the cheap), too.

1) Start where you left off. I assume that for 8th grade, the best you'd have is basic algebra. So I'd try to start there. IMO, if you can skip trig somehow, do so (I honestly think teaching trig before calc is stupid, since calc gives a really good base for everything trig to be placed upon). Discrete math and logic courses are directly applicable, but all Calculus are important, too. What is important over all else is to integrate what you learn, so you intuitively go about solving a problem with a more broad view of it, and the ability to contain logical steps to a solution in your mind. The math itself is often not used in your programming. The learning of maths forces you to think in ways you might not otherwise, and make logical connections that you otherwise would not have; and to think in ways similar to the ways that got most programming languages created.

2) No idea.

3) Newbie and C don't go together. Not be discouraging, just don't learn only C, while learning C. I'm just getting back to C from years of much higher level stuff, and it's been very good to not be using C for so long. Not that C is bad, but that thinking in higher levels of abstraction is handy; and more elegant high-level languages (IE, not Java, or ASP, PHP, SQL, etc.) aid in this by their practice (Python, Lua, Haskell, Lisp dialects, etc.). The downside being that having to do memory management yourself is kind a cold wet slap in the face smile. IMO, Python would be the best to start with alongside it, and can be directly used with C, as well. At some point, learn a LISP.

4) Start learning to program, anyway, regardless of schooling options. It's not like you'll have to work to unlearn much when you can get maths in your head. Doing things differently will come naturally. "I can't believe I didn't see <X> when I wrote that!" tongue

Last edited by cerbie (2008-12-04 16:27:15)


"If the data structure can't be explained on a beer coaster, it's too complex." - Felix von Leitner

Offline

#8 2008-12-04 18:11:23

Zariel
Member
Registered: 2008-10-07
Posts: 446

Offline

#9 2008-12-04 22:41:49

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: Learning C

tcoffeep wrote:

1 ) what sort of math should I learn? ( every time i've looked for the answer to this question, I've seen people point out algorithms, discrete mathematics, et cetera. While I plan on learning these in the future, I figure I'm going to need to strengthen my algebraic knowledge.)

A typical high-school curriculum goes something like: algebra 1, geometry, algebra 2, trig, then calculus or statistics. At the same time students get more practice in these while taking chemistry and physics.

tcoffeep wrote:

2 ) Are there any free guides for these that would suit my level? ( because of me being in-between jobs, I'm unable to afford texts ).

Self-study books for many topics can be found at the bookstore for around $20, much less than an actual textbook.

Offline

#10 2008-12-05 04:17:29

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Learning C

tcoffeep wrote:

I'm 21 years old, and currently without work. I dropped out of high school during my first year, and am currently unable to get into the college for my GED. [snip]

cerbie brings up a good point. If you're in the US, once you turned 18 you can enroll in any community college. You'll take some tests, get a placement, and begin. The odds are that you'll get a far better education at a community college. Generally speaking there are much smaller class sizes so you get to know your teacher and fellow students. You can actually get help in the classroom. If you can't, getting a tutor at a convenient time will be more likely. Also, I think you'll find many more teachers that care about teaching at the community college level.

Offline

#11 2008-12-05 06:41:55

gajo
Member
Registered: 2008-04-01
Posts: 93
Website

Re: Learning C

it really depends how much you are willing to give, and how much knowledge you are demanding
if you actually wish to learn how to program, in general, start with pascal, i hate to admit it, but it's still one of the best languages that teaches programming
then, after you understood the basics of pascal and computer programming (today at least) - structural programming, you should switch to C
remember, you need to not only learn the syntax of semntacis of the language, but also the structural method of programming
once, and only once you completaly understood that, you are to even consider OO languages, and i'd start with C++, as it's syntax is pretty much the same as C's, so you only need to focus on the OO methodology, which is quite heavy, most people that complain about C++ don't even understand it
after that, you can go for java
(just remember, microsoft still controls most of the PC market, so it's likely it would be easier, but not really enlightening to put yourself at the mercy of MS courses such as Visual Basic, C# and other really BAD languages)
i still would never suggest trying to learn languages such as python, lua... and similar, they don't teach you much, dynamic typing, automated dynamic variables, most of they aren't required to compile by default (you'll waste time fixing syntax errors), and well, they are mostly used in small projects or scripts, and more often than not highly depend on uncommon libraries

on the math part... well, formal mathematics is what you want to learn, basically, what you expect to learn(train) from mathematics is abstract thought, so it doesn't really matter which math you go for, however, only thing you actually need from maths would be Boolean algebra

Offline

#12 2008-12-05 07:15:16

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: Learning C

.

Last edited by fumbles (2020-09-24 13:03:10)

Offline

#13 2008-12-05 08:05:04

Zeist
Arch Linux f@h Team Member
Registered: 2008-07-04
Posts: 532

Re: Learning C

Learning to program in parallel to taking math classes is definitely not a bad way to go. Writing things like numerical simulations of physics, chemistry, biology or just plain math problems (or... anything else that can be computer simulated for that matter) is a great way to get a deeper understanding of what the mathematical solution to a problem tells you and why it is calculated like it is.

Last edited by Zeist (2008-12-05 08:05:33)


I haven't lost my mind; I have a tape back-up somewhere.
Twitter

Offline

#14 2008-12-05 14:49:17

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: Learning C

Pick any language.
Start small: write small programs that you can run & test & fix quickly.
As time goes on, you'll find some problems more interesting than others, and some languages more suited than others for attacking those problems. Then you'll have good motivation and reason for being picky about a language.

I think C is a good choice for a start: it will be hard in the first few steps, but _everything_ you learn with C will be useful with any other programming language / computer task. But really, any language will do.

Offline

#15 2008-12-05 16:24:23

ArchGh0ul
Member
Registered: 2008-10-23
Posts: 96

Re: Learning C

1. If you are a coding newbie there is NO reason why you shouldn't start with C! I started coding with Z80 asm...how's that for a starter language tongue? Since it was my first language I didn't find it THAT hard.
2. Complicated math is NOT a prerequisite to becoming a coder(above average one). Coding needs logic more than math..Basic understanding of Booleans is a must: http://en.wikipedia.org/wiki/Boolean_logic .Not all coders write algorithms and 3d games and such(where you'd need math like you need oxygen). I SUCK at math and consider myself an above average coder
3. Don't let anyone make you feel bad about dropping out of school. I dropped out of college too because I didn't really need it. In my line of work I got hired for my skills, not my degree. That may not be the case where you live..but around here a business is just that: BUSINESS! The best gets hired..not the one having a wall of degrees and not that much to show for.
4. K&R is a GOOD book. It's not necesary to learn from it though (I myself just skirmished through it). All the C I learned was from online tutorials and such ( I won't mention any sites..but there are 2 that are very newbie friendly).Joining a forum that deals with coding would be a step forward too. I came here from such a forum and I must say half the C I know comes from browsing those sources and talking to the dudes on there.
5. Good luck

Last edited by ArchGh0ul (2008-12-05 16:38:45)

Offline

#16 2008-12-05 21:22:51

gajo
Member
Registered: 2008-04-01
Posts: 93
Website

Re: Learning C

fumbles wrote:

I do not think it is worth while to learn C++ then Java. Java is a lot easier then C (let alone C++). If you just want to learn the basic structure of a programming language then you should go for Java. Java is like C, Java will complain if you do something stupid, C will try to do it and fail spectacularly.

That's apsurd, just because java is usually written to have a cleaner syntax than C/C++, and it has it's own GC, does not make it any simpler to understand. Sure, for someone who knows it, it's not that hard to read, maintain and write in(model for), but for someone who doesn't even understand why the hell we're using classes all of a sudden, or OO in general, it's a waste of time.
Most of what he'll be able to get from it will just be syntax.

And for the specific domain programs, I don't agree with that either. As a programmer, you don't learn just the syntax of a language - that's worthless as it is bound to change over time. You are supposed to learn the methodologies and style of programming that language teaches.

Offline

#17 2008-12-05 23:42:45

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: Learning C

.

Last edited by fumbles (2020-09-26 12:06:21)

Offline

#18 2008-12-06 12:58:22

gajo
Member
Registered: 2008-04-01
Posts: 93
Website

Re: Learning C

Control flow statements are pretty much the same in java as in C/C++, but other, basic things, such as subprograms, are best first thought in pascal/C, methods make little sense for starters. You'll end up doing a lot of things that "will be explained later", such as writing stuff like "public static void <method name>...", or calling IO functions as methods. Also, you don't have the chance of understanding how those programs are translated into machine language, which is very important for understanding some of the basic concepts (virtual methods for one) of OO (which, let's face it, you'll have to switch to later on).
Oh, and another thing, you shouldn't write your programs in an editor and then compile them by using gcc/g++, at least not as a beginner, there is no need to bother with that. I'd suggest using Codeblocks, it's free, and it incorporates stuff like gcc, g++, linkers/loaders, and has a neat debugger (not sure if it integrates gdb?).
And another thing, often, if you forget exactly how some functions are called (by called i mean executed, not named) in C, you can often get fast help by typing man <function name> in most linux distros.
The only really ugly thing C has is passing variables by address - pascal did that right, you could use references(C++) (not sure if that might be a bit too soon), right from the start.
As for getting rather ugly Seg Faults, well, you tend to learn best on mistakes smile
Not to mention getting Seg Faults are useful in understanding the need, and possibility of exception handling.

Last edited by gajo (2008-12-06 12:58:37)

Offline

#19 2008-12-06 14:06:36

string
Member
Registered: 2008-11-03
Posts: 286

Re: Learning C

gajo wrote:

The only really ugly thing C has is passing variables by address - pascal did that right, you could use references(C++) (not sure if that might be a bit too soon), right from the start.

Pointers should not be feared (like/dislike - to each their own). Once you understand them much fun can be had.

Segmentation faults are not something specific to the C programming language. Lack of attention / skill / wit - is the cause of your programs segfaulting, don't blame the tools.

Offline

#20 2008-12-06 16:19:24

gajo
Member
Registered: 2008-04-01
Posts: 93
Website

Re: Learning C

No, it's not a of fear of them, it's about their use. They shouldn't be used (in C++) to pass variables by address, or you end up with ugly code, most importantly at client (who's using your subprogram) side.
It's much more natural to call functions like read(x), then read(&x), as I said, pascal (if you remember it/ever used it), had a var keyword, which would make the parameter passed by address, making it more readable.
Often, people use C++'s compiler to compile C programs, just because of references.

Offline

#21 2008-12-06 21:18:19

string
Member
Registered: 2008-11-03
Posts: 286

Re: Learning C

I thought we were talking about C, not C++. "Often, people use C++'s compiler to compile C programs, just because of references." <- doesn't sound very kosher to me.

Offline

#22 2008-12-07 00:07:01

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: Learning C

gajo wrote:

It's much more natural to call functions like read(x), then read(&x)

Some might say it's more natural to use the return value to return x. hmm

Last edited by pauldonnelly (2008-12-07 00:13:14)

Offline

Board footer

Powered by FluxBB