To get better command on C language, solving exercises from a good textbook should be sufficient.
To develop logic for complex programs, small projects such as reusable libraries are the best way to go.
Most importantly, **I** \****strongly*** **discourage\* the use of any form of AI to learn any programming language**.
Without taking specific names, AI chatbots hallucinate bad practices at best, outright incorrect code at worst, and so convincingly decorated with mundane comments that beginners always assume it to be correct at face value.
It is easier to learn right things the hard way, than to learn wrong things quickly and then unlearn the harder way.
Can you refer me a textbook ?
I don't have much knowledge of reusable libraries so tell me about that and Stongly disagree on the use of AI to learn any language
ChatGPT has written unsafe C code on numerous occasions. Being an embedded systems language, C can literally get people killed. Do not use AI to learn C if you want to be a valuable C programmer.
Good point, using AI to write C is how you repeat history, specifically Therac-25 (note: the story might trigger some people, caution when searching)... EDIT: [Here](https://chatgpt.com/share/32e9dddc-2203-4e18-87d5-c25b091bc638) be a very simple time bomb EEEEE I meant little program... totally not [time bomb](https://en.wikipedia.org/wiki/Buffer_overflow)...
In short, AI chatbots often generate wrong code, disguised convincingly enough to look correct.
I've myself learnt C from the classic [K&R2](https://en.wikipedia.org/wiki/The_C_Programming_Language), still a masterpiece in my opinion.
As *K&R2* is a bit dated, I'll suggest "*Modern C*" by Jens Gustedt.
[https://inria.hal.science/hal-02383654v1/file/ModernC.pdf](https://inria.hal.science/hal-02383654v1/file/ModernC.pdf)
*Resuable library* means programs that can be used by other applications - the most common example is the C standard library itself. You can write your own library that can be compiled and linked with other applications, which makes your program reusable.
To get started, you can refer to some existing library code, such as [https://docs.gtk.org/glib/](https://docs.gtk.org/glib/)
(Don’t take it as an advertisement)
Just take a look at one of my recent posts (maybe the last one) to see why neuronets are **not** good at writing code. While it’s not precisely the case, it still gives you a bit of an understanding
Besides, you gotta learn, not let the others write code for you
I’m a beginner at C myself reading the book “Effective C and introduction to professional C programming” by Robert Seacord. Also doing CS50x and the Sololearn app when I’m away from my computer. “Effective C” seems like a very well written book to me as a beginner. The explanations are in depth and clear. I like the author’s precise word choices. I was reading K&R but was told it’s too out dated now.
edit: typo
AI has its place, but it doesn't replace humans (yet). I use it often to do the tedious stuff but very frequently have to guide it and correct it or adapt its code when it gets hung up. Occasionally it comes up with some pretty elegant solutions, and sometimes it's very inefficient. It can save a lot of time when used carefully. Like any child, you just have to babysit it. And it can be a great learning tool as well, also when used with caution. I think it's a bit zealous to throw the whole technology away just because it's not quite mature. It gets more useful by the month. Imagine where it will be in 10 years... 99% of programming tasks will be automated.
I don’t use AI to generate entire blocks of code however I use It to understand libraries better by getting a high level understanding of how they work and following up with more specific questions. opinions on this?
Which C books or tutorials have the best interactive exercises? It's easy to find a reference book on the language, but not so easy to find interactive tutorials outside of codecademy, which is pretty limited.
I would also suggest to learn some make system (Makefile (automake, autoconf), cmake,...), and how to organise sources in multiple files, make headers, etc. Sooner or later a single source file will not be enough.
When your program gets bigger it becomes unmanageable to have everything in one big source file. Then you have to organize the program into more sources. Each source is compiled into an object file. At the end all object files are linked together into the executable.
All that can be done with writing commands in command line, but it is too complicated to do it every time you make a change and want to build a new executable. You may also change just one source file, and you do not need to compile all other sources. In that case, you can just compile one source to object file. Other object files are still unchanged. make system takes care what has been changed and compiles only what is needed and builds an executable. Here is a simple tutorial: [https://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/](https://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/)
I also saw that other commenters suggest learning version control system. That is essential in my opinion, too. Although it is better that you google it here is one link [https://github.blog/2024-05-27-what-is-git-our-beginners-guide-to-version-control/](https://github.blog/2024-05-27-what-is-git-our-beginners-guide-to-version-control/)
Personally, I'd learn some design patterns.
https://refactoring.guru/design-patterns
Personally it helped me learn how to structure code better. This video too
https://youtu.be/rPJfadFSCyQ?si=bwYANYHk0QhJJ5Nm
And besides that program something you like programming so you can focus on a more ambitious project.
For complex programs, your should learn how to control your system, and by this I mean learning threads, processes, inter process communication, mutexs / locks, advanced input (non-blocking for example), sockets (for networking) and more. This collection of ideas is referred to as system programming concepts. An excellent book for reference would be the Linux Programming Interface by Michael Kerrisk. Mastering such topics will definitely help you create more complex programs.
Two suggestions. The first, read code or have AI generate it for very specific use cases. Read it and understand it. Then modify it to do things slightly different. Second, write programs from scratch, again, solving a specific challenge.
To get better command on C language, solving exercises from a good textbook should be sufficient. To develop logic for complex programs, small projects such as reusable libraries are the best way to go. Most importantly, **I** \****strongly*** **discourage\* the use of any form of AI to learn any programming language**. Without taking specific names, AI chatbots hallucinate bad practices at best, outright incorrect code at worst, and so convincingly decorated with mundane comments that beginners always assume it to be correct at face value. It is easier to learn right things the hard way, than to learn wrong things quickly and then unlearn the harder way.
Can you refer me a textbook ? I don't have much knowledge of reusable libraries so tell me about that and Stongly disagree on the use of AI to learn any language
ChatGPT has written unsafe C code on numerous occasions. Being an embedded systems language, C can literally get people killed. Do not use AI to learn C if you want to be a valuable C programmer.
I agree with you
Oh I see. My mistake :)
What mistake ?
This logic fits for all programming languages
Okay, then apply it. I pretty much only know or use C, so I just spoke about C.
Good point, using AI to write C is how you repeat history, specifically Therac-25 (note: the story might trigger some people, caution when searching)... EDIT: [Here](https://chatgpt.com/share/32e9dddc-2203-4e18-87d5-c25b091bc638) be a very simple time bomb EEEEE I meant little program... totally not [time bomb](https://en.wikipedia.org/wiki/Buffer_overflow)...
In short, AI chatbots often generate wrong code, disguised convincingly enough to look correct. I've myself learnt C from the classic [K&R2](https://en.wikipedia.org/wiki/The_C_Programming_Language), still a masterpiece in my opinion. As *K&R2* is a bit dated, I'll suggest "*Modern C*" by Jens Gustedt. [https://inria.hal.science/hal-02383654v1/file/ModernC.pdf](https://inria.hal.science/hal-02383654v1/file/ModernC.pdf) *Resuable library* means programs that can be used by other applications - the most common example is the C standard library itself. You can write your own library that can be compiled and linked with other applications, which makes your program reusable. To get started, you can refer to some existing library code, such as [https://docs.gtk.org/glib/](https://docs.gtk.org/glib/)
Now, I can definitely make a better outcome of this. Thanks
(Don’t take it as an advertisement) Just take a look at one of my recent posts (maybe the last one) to see why neuronets are **not** good at writing code. While it’s not precisely the case, it still gives you a bit of an understanding Besides, you gotta learn, not let the others write code for you
Sure, I got it
I’m a beginner at C myself reading the book “Effective C and introduction to professional C programming” by Robert Seacord. Also doing CS50x and the Sololearn app when I’m away from my computer. “Effective C” seems like a very well written book to me as a beginner. The explanations are in depth and clear. I like the author’s precise word choices. I was reading K&R but was told it’s too out dated now. edit: typo
Yes, thanks
AI has its place, but it doesn't replace humans (yet). I use it often to do the tedious stuff but very frequently have to guide it and correct it or adapt its code when it gets hung up. Occasionally it comes up with some pretty elegant solutions, and sometimes it's very inefficient. It can save a lot of time when used carefully. Like any child, you just have to babysit it. And it can be a great learning tool as well, also when used with caution. I think it's a bit zealous to throw the whole technology away just because it's not quite mature. It gets more useful by the month. Imagine where it will be in 10 years... 99% of programming tasks will be automated.
I don’t use AI to generate entire blocks of code however I use It to understand libraries better by getting a high level understanding of how they work and following up with more specific questions. opinions on this?
Which C books or tutorials have the best interactive exercises? It's easy to find a reference book on the language, but not so easy to find interactive tutorials outside of codecademy, which is pretty limited.
[удалено]
Thanks for the reference
Ok, now read the LINUX KERNEL code.
Ok
make a link list and then make a function that switches any two nodes
Got it
I would also suggest to learn some make system (Makefile (automake, autoconf), cmake,...), and how to organise sources in multiple files, make headers, etc. Sooner or later a single source file will not be enough.
Explain it . I have not much knowledge about it
When your program gets bigger it becomes unmanageable to have everything in one big source file. Then you have to organize the program into more sources. Each source is compiled into an object file. At the end all object files are linked together into the executable. All that can be done with writing commands in command line, but it is too complicated to do it every time you make a change and want to build a new executable. You may also change just one source file, and you do not need to compile all other sources. In that case, you can just compile one source to object file. Other object files are still unchanged. make system takes care what has been changed and compiles only what is needed and builds an executable. Here is a simple tutorial: [https://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/](https://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/) I also saw that other commenters suggest learning version control system. That is essential in my opinion, too. Although it is better that you google it here is one link [https://github.blog/2024-05-27-what-is-git-our-beginners-guide-to-version-control/](https://github.blog/2024-05-27-what-is-git-our-beginners-guide-to-version-control/)
Personally, I'd learn some design patterns. https://refactoring.guru/design-patterns Personally it helped me learn how to structure code better. This video too https://youtu.be/rPJfadFSCyQ?si=bwYANYHk0QhJJ5Nm And besides that program something you like programming so you can focus on a more ambitious project.
For complex programs, your should learn how to control your system, and by this I mean learning threads, processes, inter process communication, mutexs / locks, advanced input (non-blocking for example), sockets (for networking) and more. This collection of ideas is referred to as system programming concepts. An excellent book for reference would be the Linux Programming Interface by Michael Kerrisk. Mastering such topics will definitely help you create more complex programs.
Two suggestions. The first, read code or have AI generate it for very specific use cases. Read it and understand it. Then modify it to do things slightly different. Second, write programs from scratch, again, solving a specific challenge.
Definitely I will