Page 1 of 1 [ 16 posts ] 

K_Kelly
Veteran
Veteran

User avatar

Joined: 18 Apr 2014
Age: 33
Gender: Male
Posts: 1,452

30 Apr 2017, 7:30 pm

I'm just starting to learn how to program, this time using a C programming language book. Now, I don't know what much else to do besides typing the examples (I type one example per chapter) and doing the programming exercises at the end. What am I missing? I only get through one chapter a week, and I expect to be done or almost done with all the chapters by mid-July. I need your guidance or help.



mountainwizards
Hummingbird
Hummingbird

Joined: 30 Apr 2017
Age: 43
Gender: Male
Posts: 20

30 Apr 2017, 10:20 pm

The best thing for learning programming is a personal project, nothing else will teach you as much as something you're interested in improving and fixing. I know it can be tricky to think up a project, and C can be a difficult language for that because (unlike say Javascript, where you can make websites) it can be hard to think of C-appropriate projects.

If you're having trouble coming up with a project, and you're interested in open source software, that community is often a great way to learn programming, and many Linux Open Source software projects are written using C. Its been a while since I was involved, but this open source community in particular was welcoming to beginners, at least in the past: https://wiki.gnome.org/Newcomers

You'll probably have to install Linux though :twisted:



zenoncopy
Hummingbird
Hummingbird

User avatar

Joined: 15 Dec 2016
Gender: Male
Posts: 24
Location: halfway almost there

30 Apr 2017, 10:58 pm

Another idea is online challenges like the ones you'll find here:

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3

I think it's the best way to "practice C", because that's what the language really is good for (optimizing specific parts of a program, rather than doing entire projects). For high-level projects (things that include user interaction), I highly recommend Python instead (which is built for integration with C modules anyway).

In the end, for most programmers nowadays, I think the main use of C is as a learning tool to understand first-hand "how a computer thinks", so you'll know what kinds of fundamental structures and technical limitations any high-level programming toolkit you may use will be dealing with behind the scenes. Unless you're specifically interested in near-hardware-level programming. In that case, C really is the right language for you. And the minimalistic language design really is something to be admired.

Open-source projects are a mixed bag. Some are known to be very friendly, but I wouldn't count on most them being friendly. Some are known to have toxic environments instead, for newcomers and veterans alike. There's a lot of personal ego involved in "the community".


_________________
and my fake laugh would suddenly sound sincere


mountainwizards
Hummingbird
Hummingbird

Joined: 30 Apr 2017
Age: 43
Gender: Male
Posts: 20

30 Apr 2017, 11:44 pm

I second the recommendation to learn Python if your goal is learning to program. There's a lot of good online tutorials and free courses for python, and its a very practical language for accomplishing day to day tasks.



K_Kelly
Veteran
Veteran

User avatar

Joined: 18 Apr 2014
Age: 33
Gender: Male
Posts: 1,452

01 May 2017, 8:07 am

Honestly, I don't know if it's just me, but me using Python as a first language never really clicked. I might pick it up again someday, but for now I'm just going to get dirty.



saxgeek
Veteran
Veteran

Joined: 18 Jul 2015
Age: 29
Gender: Male
Posts: 730

02 May 2017, 12:31 am

You don't need to learn Python. C is a perfectly fine language for all kinds of software projects, including games, media players, photo editors, desktop environments, web servers, you name it. At least half of the code in your computer and phone operating system is written in C. The core of Linux, Mac OS X, Windows, Android, and iOS is C. The popular GNOME desktop environment is mostly in C. C is also the dominant language for embedded software development. That LED display on your microwave, those gadgets in your car that tell you when you're low on gas are likely running from C code. Guess what language the interpreters for Python, Ruby, PHP, Lua and Perl are written in? All of them are in C. Even most software projects written in other languages like C++ still depend on libraries and frameworks written in C, because C has a standard, well documented ABI that is very easy for other programming languages to interface with.



K_Kelly
Veteran
Veteran

User avatar

Joined: 18 Apr 2014
Age: 33
Gender: Male
Posts: 1,452

02 May 2017, 7:47 pm

It's hard to think of ideas when your not as proficient in the language your using yet.



XenoMind
Veteran
Veteran

User avatar

Joined: 12 May 2014
Gender: Male
Posts: 684
Location: Absurdistan

03 May 2017, 12:16 pm

K_Kelly wrote:
I'm just starting to learn how to program, this time using a C programming language book. Now, I don't know what much else to do besides typing the examples (I type one example per chapter) and doing the programming exercises at the end. What am I missing? I only get through one chapter a week, and I expect to be done or almost done with all the chapters by mid-July. I need your guidance or help.


You are wasting time. You will never achieve nothing doing it this way.
Find a real task, simple enough for you, and start solving it from scratch. Never "type the code from the book" and never copy-paste it, write the code from your head.
And btw, C is a horrible language for the beginner. Use Java, C# or Python.



Chichikov
Veteran
Veteran

User avatar

Joined: 27 Mar 2016
Age: 50
Gender: Male
Posts: 1,151
Location: UK

04 May 2017, 9:33 am

For basic beginner programs try a calculator or hangman. A calculator is good as it involves inputs, parsing text to numbers, interpreting input in an intelligent way, and you can start simple with add, subtract, multiply and divide then extend to other operators and to parenthesis etc which involves working out the right order to do things with. Then you can implement "memory" and other advanced features. It can also be done with simple text input and output, but you can move on to build a GUI instead as another advanced update.



saxgeek
Veteran
Veteran

Joined: 18 Jul 2015
Age: 29
Gender: Male
Posts: 730

04 May 2017, 12:31 pm

Going through 1 chapter in a textbook per week is not a bad pace. Most college classes go about that speed. Just start out small. A text adventure game or a unit converter would be a nice thing to make. It just requires standard input and output. You can get lots of help on internet forums and IRC if you're stuck with something.



MountainFoo
Emu Egg
Emu Egg

Joined: 1 Jun 2017
Age: 50
Gender: Male
Posts: 1

01 Jun 2017, 12:55 pm

How are you getting on learning C? :D



elf_wizard
Tufted Titmouse
Tufted Titmouse

Joined: 22 Jun 2017
Age: 45
Gender: Male
Posts: 38
Location: USA

22 Jun 2017, 7:20 pm

It's good you are programming. I picked it up perhaps not so differently from yourself and now it's my living. It's given me a lot of enjoyment (and a gray hair or two) over the years.

My question is, what's your goal? Are you doing this for fun or trying to become a professional? Or, maybe you haven't got a goal. Whichever way, I can productively add to the replies if I know the answer to that!

Generally though, applying yourself, having fun, staying interested and not quitting are habits that will pay off in the long run.



K_Kelly
Veteran
Veteran

User avatar

Joined: 18 Apr 2014
Age: 33
Gender: Male
Posts: 1,452

22 Jun 2017, 7:42 pm

A note: I don't know if it's because of my Asperger's functioning or something else, I got distracted from learning how to write programs after just beginning, because of feeling depressed or some stuff. And I also have a hard time getting back on the track, despite how much I think about doing it. It's like I can't find time to continue or that I am somehow lazy.
---------------
For my goals, if I can make this as a professional skill, that'd be awesome (and probably encouraged by those who know me), but as much as a goal that may be, I'm feeling like I have a slightly different priority right now.

I know that this is a very tough programming niche to get into, but I want to develop my own operating system and every utility and application from the ground up. But this is too major for right now. I think I'll have time on my side as a strength/advantage in that kind of endeavor. I'm not saying this should be my only goal, but it's what is inspiring me, as gargantuan as this goal sounds.

So maybe this is not that important at the moment, but I think resources on CPU and hardware may come in handy.



wbport
Sea Gull
Sea Gull

User avatar

Joined: 16 Sep 2012
Gender: Male
Posts: 220

24 Jun 2017, 3:48 pm

Can you calculate the monthly payment of a loan given the principal, interest rate, and length of the loan? Divide the interest rate by 12 and do the calculation in months. Later add a table showing how loan balance, how much of each payment goes to pay down the principal and how much is interest. Suppose you know the monthly payment but are missing one of the other factors, how do you calculate it? You might not be able to calculate some of them directly but you can create loops ("this value I tried gives an answer that is too low (or high), what do I try next") to close in on the answer.

Create a round robin schedule after prompting for the number of players. Arrange the numbers from 1 to n in a random order to assign pairing numbers to the participants/teams.

Those are just a few ideas. Keep your "I wonder how/if?" hat on throughout the day and you might get some ideas of what to try to program.

If you have been introduced to recursion, try the eight queens problem (or change the size of the board for more or less). The knight's tour is also solved this way, but try moves to the corner, side, and center in that order. Solve the peg solitaire puzzle found at Cracker Barrel (also uses recursion).

That should get you started.
Edited: Some colleges have programming contests for high school students. If you can find problems used in previous year's contests, that might have some challenging projects for you to tackle. The one I participated in (as a judge) was timed so they can't be really big.



elf_wizard
Tufted Titmouse
Tufted Titmouse

Joined: 22 Jun 2017
Age: 45
Gender: Male
Posts: 38
Location: USA

28 Jun 2017, 4:31 pm

K_Kelly wrote:
I know that this is a very tough programming niche to get into, but I want to develop my own operating system and every utility and application from the ground up. But this is too major for right now. I think I'll have time on my side as a strength/advantage in that kind of endeavor. I'm not saying this should be my only goal, but it's what is inspiring me, as gargantuan as this goal sounds.


You might find "The Elements of Computing Systems" by Nisan & Schocken interesting. It guides you through building a basic virtual computer starting with a NAND gate. Fun & you'll learn lots.

There are lots of good other suggestions in this thread too, when you come back to it.



Ichinin
Veteran
Veteran

User avatar

Joined: 3 Apr 2009
Gender: Male
Posts: 3,653
Location: A cold place with lots of blondes.

06 Aug 2017, 8:09 am

I haven't seen a job ad for C programmers since the mid 1990's. Unless you are doing it for fun, you will be SOL on the job market.

Also, here are some some security tips when coding in C.


_________________
"It is far better to grasp the Universe as it really is than to persist in delusion, however satisfying and reassuring" (Carl Sagan)