I'm learning C

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96
That's another nice thing about C and C++ -- there are decades worth of tutorials and sample code, and there are libraries out there to do anything you want.

I'm a Windows application developer and we use native C++ not C# at work. C# is quite popular though, especially for creating programs for internal use by corporations.
So far I'm finding C easier to learn then what the naysayers have claimed. Especially after looking at the source code provided by the sanfoundry.com site.

Since learning C does make learning other languages easier, maybe we should be teach it to High School students instead of any form of BASIC?
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
You could certainly teach a subset of C, and maybe leave out some of the tricky parts.

I think these days in high school they've switched to visual programming languages like Spark and "safe" languages like Java. You can write clean and safe C, but you can also write dangerous and difficult to debug C without even trying. With a pointer you can corrupt all of your data, mes up the stack, and in older OSs write over your program code.
 

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96
You could certainly teach a subset of C, and maybe leave out some of the tricky parts.

I think these days in high school they've switched to visual programming languages like Spark and "safe" languages like Java. You can write clean and safe C, but you can also write dangerous and difficult to debug C without even trying. With a pointer you can corrupt all of your data, mes up the stack, and in older OSs write over your program code.
True. One thing have to ask, how old was the youngest child that started using C for programming? I'm thinking 8 or 9.
 

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96

mv2devnull

Golden Member
Apr 13, 2010
1,503
145
106
I'll avoid using it for now as I'm trying to learn ANSI C and I petty much want to keep any programs I write to be portable.
I think that was the point of Chaotic42's suggestion.

Write function 'getline' with ANSI C. It will be part of your programs and portable. Your programs can use it.
In order to write the safe 'getline' you have to learn the ANSI C input functions and dynamic memory management.

Educational and useful.

The getline is about encapsulation. There is quite a lot of work in reading unknown amount of text. If most of the details are hidden into a function, then the programs that have to read text stay simple.
 

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96
I think that was the point of Chaotic42's suggestion.

Write function 'getline' with ANSI C. It will be part of your programs and portable. Your programs can use it.
In order to write the safe 'getline' you have to learn the ANSI C input functions and dynamic memory management.

Educational and useful.

The getline is about encapsulation. There is quite a lot of work in reading unknown amount of text. If most of the details are hidden into a function, then the programs that have to read text stay simple.
OK I understand now. I'm not really at the stage where I can write C programs. One issue I have run into several time is crappy material and webpage rendering issues not showing the code correctly in the first place Anyway I started over with wikibooks.org and D/L the manual as a PDF file which I also put on my Kindle.

Good thing I didn't pay good money for crappy manuals, that would shut me down faster and harder then anything else,
 

Staples

Diamond Member
Oct 28, 2001
4,952
119
106
Something I do appreciate about C is that it hasn’t changed much in decades. Take a modern language like C#, a language I really like and my God, they keep adding more stuff to the language every two years. We are now on version 7.
Also, as much as I hate JavaScript, you can do a lot with it these days using the node.js runtime. Good easy language for beginners.
 

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96
Something I do appreciate about C is that it hasn’t changed much in decades. Take a modern language like C#, a language I really like and my God, they keep adding more stuff to the language every two years. We are now on version 7.
Also, as much as I hate JavaScript, you can do a lot with it these days using the node.js runtime. Good easy language for beginners.
Well It's not JavaScript I hate, it is all of the bad code and the stuff that it is used for. But yeah in the late 90's it wasn't worth crap and I ended up turning JavaScript off half the time.
 

urvile

Golden Member
Aug 3, 2017
1,575
474
96
Something I do appreciate about C is that it hasn’t changed much in decades. Take a modern language like C#, a language I really like and my God, they keep adding more stuff to the language every two years. We are now on version 7.
Also, as much as I hate JavaScript, you can do a lot with it these days using the node.js runtime. Good easy language for beginners.

Personally I don't think anyone should be. It's a client side language that was designed to be used in a browser. Specificallly to manipulate the DOM. Although I did find out recently that javascript/node has an ORM* for connecting to relational databases. My first thought was why?

*Previously I thought it just used nosql databases because they are really easy to use. My main issue** with node is it's difficult to teach good fundamentals with javascript. Although I am starting to see more job ads for full stack javascript devs. The future is coming kids....it's coming.

bye.

**actually I have a lot of issues with javascript, node and how we might end up with a generation of programmers who only know javascript and.... node .While not really understanding correct OO design and programming, as well as things likes async programming, SOA or how to actually design and implement scalable solutions because hey......it's all hidden from view.

Although I don't think JS is multithreaded anyway.

Maybe in html 5 JS is multithreaded though? Maybe events are a form of async programming? I don't know. I have spent the last week in sydney.....

I am mainly here to lift heavy things. Because I lift heavy things good.
 
Last edited:

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96
Well I'm still having fun learning C and managed so far to stick with it. While I'm doing this for my amusement and needs, if I end up even just being able write simple programs for myself and that other people find useful, that would be great.
 

Staples

Diamond Member
Oct 28, 2001
4,952
119
106
I hear you. It is scary that Node is so popular and we may have a generation of kids who only know Javascript. I used to say this about PHP 10-15 years ago but JS is even worse.
I've used ASP.NET, PHP and Python over the years for web development. Node has been all the rage for a few years so I decided to look into it recently. I am not sure if it is true but all the hype makes it seem like there is zero downside to Node/JS development (besides it being single threaded). Despite the downside, there are big heavy traffic websites that have converted their code and now run on Node. If it is good enough for Walmart, Paypal, Ebay and others, then JS only programmers are what the future might have in store.
 

Chaotic42

Lifer
Jun 15, 2001
33,929
1,098
126
I think that was the point of Chaotic42's suggestion.

Write function 'getline' with ANSI C. It will be part of your programs and portable. Your programs can use it.
In order to write the safe 'getline' you have to learn the ANSI C input functions and dynamic memory management.

Educational and useful.

The getline is about encapsulation. There is quite a lot of work in reading unknown amount of text. If most of the details are hidden into a function, then the programs that have to read text stay simple.

Yep, that was what I was aiming for. It's a very useful function to have and you should be able to find a lot of solutions of varying quality online. It really captures a lot of the core tricks and strategies when learning C. It's also a lesson about portability - you can't assume that everyone will have the standard GNU toolset. If you do decide to write it, trying throwing it curveballs. What happens if you feed it a Unicode text file...?
 

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96
I hear you. It is scary that Node is so popular and we may have a generation of kids who only know Javascript. I used to say this about PHP 10-15 years ago but JS is even worse.
I've used ASP.NET, PHP and Python over the years for web development. Node has been all the rage for a few years so I decided to look into it recently. I am not sure if it is true but all the hype makes it seem like there is zero downside to Node/JS development (besides it being single threaded). Despite the downside, there are big heavy traffic websites that have converted their code and now run on Node. If it is good enough for Walmart, Paypal, Ebay and others, then JS only programmers are what the future might have in store.
I doubt that I will do any Web development other then html as I'm only interested in writing stand alone applications intended to be run locally.

Personally I think that everyone should learn C and C++ at some point.
 

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96
Yep, that was what I was aiming for. It's a very useful function to have and you should be able to find a lot of solutions of varying quality online. It really captures a lot of the core tricks and strategies when learning C. It's also a lesson about portability - you can't assume that everyone will have the standard GNU toolset. If you do decide to write it, trying throwing it curveballs. What happens if you feed it a Unicode text file...?
I just may do that as I learn more and become more capable.
 

urvile

Golden Member
Aug 3, 2017
1,575
474
96
I hear you. It is scary that Node is so popular and we may have a generation of kids who only know Javascript. I used to say this about PHP 10-15 years ago but JS is even worse.
I've used ASP.NET, PHP and Python over the years for web development. Node has been all the rage for a few years so I decided to look into it recently. I am not sure if it is true but all the hype makes it seem like there is zero downside to Node/JS development (besides it being single threaded). Despite the downside, there are big heavy traffic websites that have converted their code and now run on Node. If it is good enough for Walmart, Paypal, Ebay and others, then JS only programmers are what the future might have in store.

Don't get me wrong. There are plenty of use cases for it. For me it's completely irrelevant. You can't use a javscript back end for what I do (me, me, me) but for large scale e-commerce sites it does make a lot of sense. Especially because it's so easy to scale. Still it's a new technology. Well sort of new? JS is also really good for beginners but I think it's a little bit to forgiving. It will be interesting to see if node is still around in 5 years.

I actually spent the last two years doing a lot of javascript/jquery because I didn't have any experience with it. I got to the point where I was going to go postal if I had to keep doing front end work. Now I am on the backend again where I (and JS doesn't) belong.

Also just because ebay and whatnot use node doesn't mean enterprise is going to. It's just not practical. You will have to trust me on that one.

EDIT: At the risk of getting pelted with rotten fruit. I can tell you that the enterprises I have worked for do not give a care about what ebay or any of those tech companies do. That's not how languages, methodologies, toolsets etc. for projects are chosen.

This is just my experience of course YMMV.

EDIT2: ebay and whatnot have a completely different usecase. They need to be able to handle a lot of concurrent users. Most software developed by enterprise doesn't because it's not web facing or it's pure back end. SOA, distributed etc. which is connecting to other systems using services a message broker or whatnot.

Anyway. Sorry for the hijack OP.
 
Last edited:

urvile

Golden Member
Aug 3, 2017
1,575
474
96
At the risk of launching into a frothing at the mouth rant. There are a lot reasons why companies do things. For organisations to throw away their current solution and then re-implement the solution using a different technology would suggest they are getting some serious benefits from it. Because it costs a fortune to do that with such a large scale site. For me the things I need from a language are different, I need a decent OO implementation for example so I can use patterns like adaptor to abstract my datastores. There are a lot if, buts and maybes....

Although if anyone knows how I can do that sort of thing in JS I would genuinely like to know.

Once again sorry OP. Enjoy your C!
 

whm1974

Diamond Member
Jul 24, 2016
9,460
1,570
96
At the risk of launching into a frothing at the mouth rant. There are a lot reasons why companies do things. For organisations to throw away their current solution and then re-implement the solution using a different technology would suggest they are getting some serious benefits from it. Because it costs a fortune to do that with such a large scale site. For me the things I need from a language are different, I need a decent OO implementation for example so I can use patterns like adaptor to abstract my datastores. There are a lot if, buts and maybes....

Although if anyone knows how I can do that sort of thing in JS I would genuinely like to know.

Once again sorry OP. Enjoy your C!
I don't mind going off topic every now and then as long it is related to programming and if I'm learning more as I go along.

Even if I go bust in learning C, I'm exercising my other skills and hopefully pick up some new ones in the meantime.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,282
3,904
75
An interesting article related to this by Eric S. Raymond: http://esr.ibiblio.org/?p=7711

ESR said:
I reached a startling realization – I have 35 years of experience in C. I write C code pretty much every week, but I can no longer remember when I last started a new project in C!
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |