LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2024, 11:18 AM   #1
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 318

Rep: Reputation: 171Reputation: 171
Advice on how to move on from being a beginner in C.


To stave off boredom after retirement I got hold of a copy of Kernighan and Ritchie and started reading it. Of course, I could not resist trying the code. However, K&R was a bit too hard for an elderly newcomer to C, so I moved to KN King's 'C programming - a modern approach'. This was more accessible and I have completed it and many of the exercises/ programming projects in it.

So what next? I think that to get better I need to write programs. However I struggle to think of suitable ideas.
A Google search produced suggestions like Rock, paper, scissors, which is not too interesting. However I am not good enough to tackle harder problems. I am doing this for fun and would like to stick to C.

So, my question is, how do you take the next step from being a complete novice to becoming a bit better? I feel like I have stalled. Any advice on how to move forward?

Last edited by amikoyan; 01-20-2024 at 11:19 AM.
 
Old 01-20-2024, 12:42 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
Check out some links and suggestions in the sticky

https://www.linuxquestions.org/quest...orials-825748/
 
Old 01-20-2024, 01:00 PM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,347
Blog Entries: 3

Rep: Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766Reputation: 3766
You might consider following the OpenBSD project on a spare machine. Specifically their current branch is of use since the updates are distributed only as patches to the system's source code. If you start by installing a snapshot, unpacking the source tree there, and then start tracking -current via the relevant mailing lists (source-changes and tech and maybe bugs) that will give you a lot of small pieces to handle and examine. Just a head up -- those three lists should be considered read-only at the beginning.

Their style is quite clear and they have a strong emphasis on both readability and correctness. Some parts of OpenBSD will be too advanced, but others will be within reach. And along the way it might give you ideas to work on for your own programs or, once in a while, a patch for them.
 
1 members found this post helpful.
Old 01-20-2024, 01:17 PM   #4
EdGr
Senior Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 1,002

Rep: Reputation: 473Reputation: 473Reputation: 473Reputation: 473Reputation: 473
The best programs to write are the ones that will be useful to you.

At various times, you have probably thought "If only I had a program that did ___".

All of my programs got started that way.
Ed
 
1 members found this post helpful.
Old 01-20-2024, 01:31 PM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
Write a queene, i.e. a program that prints its own source. (It has to store the source within the code, no external file can be used.)
 
2 members found this post helpful.
Old 01-20-2024, 02:04 PM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,027

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
as it was written, use it. Write your own program. To make it more interesting try to find a goal for yourself. For example implement a simple game, calculator or lottery number generator.
The three most important things are: practice, practice and more practice.
 
1 members found this post helpful.
Old 01-20-2024, 02:33 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Quote:
Originally Posted by NevemTeve View Post
Write a queene, i.e. a program that prints its own source. (It has to store the source within the code, no external file can be used.)
Note: Spelled "Quine", named after Willard Van Orman Quine. Further searches left to those interested (and it is interesting!).

Thanks!
 
Old 01-20-2024, 02:35 PM   #8
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 318

Original Poster
Rep: Reputation: 171Reputation: 171
Thank you very much for these suggestions.

The program that prints its own source sounds interesting. A printf that prints #include <stdio.h> and everything else, including itself I suppose... hmm

Also tracking OpenBSD - I don't have a spare machine but I could install it on Virtualbox.

Sounds more fun than suduko.
I will look into all of them.
 
Old 01-20-2024, 03:16 PM   #9
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Ideally, you would program something that you find personally useful. For example, maybe you want to search for file names that contain special characters, because those can be annoying later on (when, for example, sharing files with someone who uses Windows).

C isn't necessarily the best programming language to write such a utility with, but it'll do fine and you'll feel better creating something that you actually can use and probably learn a lot along the way.

If there's no such utility that comes to mind, you can try some old school 1970's style BASIC games. Daleks/Robots is a good one that's pretty easy to code and also can be expanded into a dungeon crawler. Each "turn", you just print out a map showing your position and the Daleks, and user input is simply movement in one of the 8 directions or to wait in place.
 
Old 01-20-2024, 06:46 PM   #10
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
Call this "Well intended, but gruff sounding advice"

A common misnomer I'm concerned about, may or may not be an issue for you. And I'm not about forcing anyone to follow a direction they're not inclined to.

The misnomer is that people embark upon learning a "language" and they feel this will make them a programmer. Their project challenges will likely grow, and depending upon the person, their programming may be limited by their own bias, and also limited collaborative exposure to other designers.

Some people will say, (a) I have to start somewhere, that is true, or also (b) I'm really doing this for fun, please help me/guide me, but do not criticize.

Where I'm coming from is that programming is solving a problem or using a process/algorithm to do things, it's not merely the acion of writing and running code.

Example: auto loan, simple interest. 10,000 @ 5% over 4 years. Calculate the payment. A: ((10,000 x 0.05 x 4) + 10,000)/48 = Monthly payment

Then you can modify that to compute compounding interest, accept variable inputs for financed amount, interest rate, and term.

Once you know WHAT you want to do, and HOW in spoken language a.k.a. pseudocode, the actual programming can be done in any language and using numerous means within most languages to attain the same result. And within any language there are multiple ways to achieve similar, correct results.

If all you ever wish to do is "write some programs" please understand that as your sophistication of projects grows, similarly those who haven't followed your start and progress, may challenge from the perspective of your DESIGN. And you may take this as criticism. Please bear in mind that many experienced persons have done this a lot, for years, for work or academia, and encountered design challenges, which ultimately grew their knowledge and abilities, that is really where people are coming from, and they also have heard critical analysis of their former designs and code, it is normal, versus harshly intended criticisms.

Not at all trying to discourage anyone from this type of exploration, just making my personal distinction between writing code and programming. I would very much be the type who would interpret most person's code questions from the perspective that they are trying to learn the subject of programming not just code. Maybe that's an unpopular stance, I guess my bias is that I've solved problems for years in many languages, using many design manners, and also constantly improved my knowledge and abilities to design and code better. To whit, and I've lived this, one can take on a programming project in any language even if they've never used that language or heard of it before, but still be successful if they understand how to frame a problem and design a process to solve it.

Just a perspective to share.
 
3 members found this post helpful.
Old 01-21-2024, 03:30 AM   #11
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 318

Original Poster
Rep: Reputation: 171Reputation: 171
Quote:
Originally Posted by rtmistler View Post
Call this "Well intended, but gruff sounding advice"

The misnomer is that people embark upon learning a "language" and they feel this will make them a programmer. Their project challenges will likely grow, and depending upon the person, their programming may be limited by their own bias, and also limited collaborative exposure to other designers.
Your advice does not sound at all 'gruff', instead it sounds like wise words from someone with years of experience behind them.

I am humble enough to know that writing a few programs will not make me a programmer, just as replacing a faulty washer does not make me a plumber. I appreciate that someone who has made a living as a programmer, in any setting, commercial or academic, knows far more than I ever will.

I play golf sometimes and want to improve my short game. I know that a couple of hours practice and watching a golf video does not make me a pro. I just want to get 'bit better than the last time' I played, if you see what I mean.

I might be doing this for 'fun' as I put it, but I do want to get better. So I appreciate when people here give me advice and I reflect on it and try my best to understand it. I will never call myself a programmer, just like I will never be a 'golfer'. I leave that to the pros.

I suspect that some of the people who so generously offer their time and advice here are very, very knowledgeable indeed. As in outstandingly good. I value any advice from such people. Indeed it would be foolish not to.

Last edited by amikoyan; 01-21-2024 at 03:48 AM.
 
1 members found this post helpful.
Old 01-21-2024, 05:17 PM   #12
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,683
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
“You need to get in the water and stay there.”

But you could also begin to expand your horizons, say to “C++.”

Furthermore, “git repository” websites such as “GitHub” and “SourceForge” contain thousands of “complete applications,” searchable by language. You can use this to encounter, and explore at your leisure, fully-developed and debugged applications that are usually not trivial. (Although “instructional” projects are out there too.) I am a firm believer in the maxim that: ”you can learn a lot by watching.”

This is also important when you think of something that you’d like to do. “Has somebody else already done it?” (Likely.) But maybe you can improve upon it. The key idea, today, is that “nobody starts in a vacuum.” Instead, “we build on the shoulders of giants.”

Last edited by sundialsvcs; 01-21-2024 at 05:18 PM.
 
Old 01-22-2024, 12:45 AM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,027

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
Yes, although it is almost offtopic, just an idea:
I have some esp32 and esp8266 boards. You can create useful things with them, if you are interested. There is a lot of ready-made c/c++ code available for them, you just have to adapt it to your needs. Sometimes it is easier, but obviously can be difficult too.
 
1 members found this post helpful.
Old 01-22-2024, 01:14 PM   #14
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 318

Original Poster
Rep: Reputation: 171Reputation: 171
Quote:
Originally Posted by pan64 View Post
Yes, although it is almost offtopic, just an idea:
I have some esp32 and esp8266 boards. You can create useful things with them, if you are interested. There is a lot of ready-made c/c++ code available for them, you just have to adapt it to your needs. Sometimes it is easier, but obviously can be difficult too.
Thank you pan64 for the suggestion. I searched them, and they look like interesting boards.

However, I have found MIT's Xv6 https://pdos.csail.mit.edu/6.828/2023/xv6.html and I have been tinkering with writing a few basic user programs. I think the MIT course that goes with Xv6 gets very hard quite quickly, so I will take my time. Last year I got Research Unix Version 6 running in a SimH PDP-11/40 Emulator, so Xv6's 'modern' take on Unix sounds like something I would be interested in.

As well as thanking pan64, I would like to express my gratitude to all of you who took the time to answer me.Your responses helped focus my thoughts and have encouraged me to keep exploring.
 
Old 01-23-2024, 12:59 AM   #15
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,027

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
Quote:
Originally Posted by amikoyan View Post
Thank you pan64 for the suggestion. I searched them, and they look like interesting boards.

However, I have found MIT's Xv6 https://pdos.csail.mit.edu/6.828/2023/xv6.html and I have been tinkering with writing a few basic user programs. I think the MIT course that goes with Xv6 gets very hard quite quickly, so I will take my time. Last year I got Research Unix Version 6 running in a SimH PDP-11/40 Emulator, so Xv6's 'modern' take on Unix sounds like something I would be interested in.

As well as thanking pan64, I would like to express my gratitude to all of you who took the time to answer me.Your responses helped focus my thoughts and have encouraged me to keep exploring.
I have to say this is the best, you have your own way. Good luck!
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
seeking advice -total beginner- how to integrate website and membership database theduck70 Linux - Newbie 5 02-09-2009 03:18 AM
Beginner needs some advice treble54 Linux - Laptop and Netbook 5 08-05-2005 09:37 AM
Advice on best distro for beginner with speed/USB issues rollo Linux - Newbie 4 05-01-2004 09:21 AM
Beginner looking to start: Advice required pembo13 Programming 1 03-12-2004 09:37 PM
Beginner needs Advice Sean030 Linux - Newbie 2 12-17-2002 05:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration