Learn C Programming: Tips for Engineering Student

  • Thread starter Thread starter AK2
  • Start date Start date
AI Thread Summary
Learning C programming is crucial for engineering students, but mastering it can be challenging. Many participants suggest that practical coding is essential, emphasizing that one cannot learn effectively from books alone. Resources like "The C Programming Language" by Kernighan and Ritchie are recommended for their clarity and practice problems. Additionally, websites like Project Euler provide a variety of coding challenges to maintain interest and improve skills. Overall, consistent practice and engagement with practical projects are key to successfully learning C.
AK2
Messages
39
Reaction score
0
I'm presently an engineering undergraduate student. Learning C language is very important for my degree program. I'm using Sam's Teach Yourself C in 21 days. Its obvious I can't learn C in 21 days. I have covered 10 chapters out of the 21 chapter book. Its kind of frustrating learning C that I had to slow down my pace and look through the first 10 chapters. So what is the best way to learn C programming. I read some where that C is a programmer's programmer language. C is the first computer program I am learning. Any advice will be welcome
 
Technology news on Phys.org
AK2 said:
So what is the best way to learn C programming.

The same way a violinist gets to Carnegie Hall: "Practice, practice, practice!"
 
AK2 said:
I'm presently an engineering undergraduate student. Learning C language is very important for my degree program. I'm using Sam's Teach Yourself C in 21 days. Its obvious I can't learn C in 21 days. I have covered 10 chapters out of the 21 chapter book. Its kind of frustrating learning C that I had to slow down my pace and look through the first 10 chapters. So what is the best way to learn C programming. I read some where that C is a programmer's programmer language. C is the first computer program I am learning. Any advice will be welcome

Throw the book out through the window and start to code.
 
jtbell said:
The same way a violinist gets to Carnegie Hall: "Practice, practice, practice!"
I have been practicing but I'm losing interest. Are there any sites where I can get problems to practice on since I've done all the problems in the chapters I have covered so far.

DanP said:
Throw the book out through the window and start to code.

How will that help me?
 
AK2 said:
I have been practicing but I'm losing interest. Are there any sites where I can get problems to practice on since I've done all the problems in the chapters I have covered so far.
How will that help me?

You can't learn swimming from books. You actually have to get in the water at some point.
The same is with coding. You actually need to write code to learn it well.
Sit at your computer. Your C compiler should have a reference, use that for help and write code. Again and again.

The only "difficult" thing in C with which I seen ppl (who never programmed in any language before) having issues with are the pointer mechanism, & and * operators, and array addressing. Type conversions should be easy. Rest of C is self-explanatory.

If you are bored with problems, start to write small programs. Find something which excite your imagination and make a program :P
 
DanP said:
You can't learn swimming from books. You actually have to get in the water at some point.
The same is with coding. You actually need to write code to learn it well.
Sit at your computer. Your C compiler should have a reference, use that for help and write code. Again and again.

The only "difficult" thing in C with which I seen ppl (who never programmed in any language before) having issues with are the pointer mechanism, & and * operators, and array addressing. Type conversions should be easy. Rest of C is self-explanatory.

If you are bored with problems, start to write small programs. Find something which excite your imagination and make a program :P

Thanks. I will take into practice what you just posted.
 
AK2 said:
...I'm using Sam's Teach Yourself C in 21 days...
The best book I know is the first one: "The C programing Language", by Kernighan & Ritchie (the fathers of the C language).
No several equivalents examples, not twice the same thing. It is a concise book, and each line is valuable.
 
Kittel Knight said:
The best book I know is the first one: "The C programing Language", by Kernighan & Ritchie (the fathers of the C language).
No several equivalents examples, not twice the same thing. It is a concise book, and each line is valuable.

Does it have a lot of practice problems and examples. I need something like that to master C at a faster pace.
 
AK2 said:
Does it have a lot of practice problems and examples. I need something like that to master C at a faster pace.

Yes it does have practice problems and examples throughout the book. I highly recommend it.
 
  • #10
AK2 said:
Does it have a lot of practice problems and examples.
Yes. The authors work through the examples and put a bunch of practice problems at the end of every chapter. It's also really clear and concise (a model of good technical writing), which makes it much easier to get through.
 
  • #11
AK2 said:
Does it have a lot of practice problems and examples. I need something like that to master C at a faster pace.

pheeesics said:
Yes it does have practice problems and examples throughout the book. I highly recommend it.

Thanks. I'm ordering the book now.
 
  • #12
AK2 said:
I have been practicing but I'm losing interest. Are there any sites where I can get problems to practice on since I've done all the problems in the chapters I have covered so far.

http://projecteuler.net/

This is a good site irrespective of what language you are studying. It starts up with quite simple problems but eventually they become quite difficult.
 
  • #13
I have been practicing but I'm losing interest. Are there any sites where I can get problems to practice on since I've done all the problems in the chapters I have covered so far.

The approach of just keeping with the sample C programs is an admirable one. However if you really are having trouble focusing on the C examples you may want to consider learning a "simpler" language, like Python or Java, and then coming back to C when you have a better grasp of programming fundamentals.

There are kind of two things you really need to learn, one is "how to program", the other is how to program in C. It is perfectly possible to learn both at once. But for some people trying to start out with C, with its added requirements (compared to some languages) of understanding how memory addresses and allocation work just to do basic things with strings, obscures what you really need to learn about programming. It's also the case that doing certain "real things" (like, I don't know, editing a PNG) become possible lower on the learning curve with some of those other languages, which may make it easier to maintain that focus.
 
  • #14
write some programs that you can use: a hex dumper, a program that reads a text file and numbers the lines, a syntax colorer, etc
 
  • #16
I found C very easy after I learned assembly language.
 
  • #17
@rootX: I've heard a lot of people comment that C *is* pretty much the same as assembly language. It does not permit you not to know everything about what is happening within the memory.
 
  • #18
K & R The Computer Langauge book is advanced for me. The good thing is that it has a lot of problems. I will probably start with it after I've finished the one I am using now which is a book for novices. I'm on the chapter on structures and I'm finding it to be a very interesting topics. Thanks for the responses.
 
  • #19
for all language c is base so that c should study perfectly by getting book of local author so that you can understand easily also make use of w3school website that too helps lot and lot
 
  • #20
A great book is Herb Shildt's "C++: The Complete Reference"

C is not a great language to start with. You would have definitely benefitted from learning Basic or something first. However, you will get through it. Practice writing little console apps to do things like Conway's Game of Life, etc. Start small and work your way up. Good luck.
 
  • #21
technoweasel said:
A great book is Herb Shildt's "C++: The Complete Reference"

C is not a great language to start with. You would have definitely benefitted from learning Basic or something first. However, you will get through it. Practice writing little console apps to do things like Conway's Game of Life, etc. Start small and work your way up. Good luck.

I agree with you that C is not a great language to start with. I had to look at time constraint. I decided I have to learn C at once because I'm an engineering student and we use C to program microcontrollers. We also use matlab. I'm planning to finish learning all the chapters in the book I'm using to learn C and pick up and start learning matlab. I read a post by a programmer stating that once I learn C picking up another language will be easy.
 
  • #22
I have a somehow related question, and didn't want to start a separate thread.

I need to take a programming sequence as a requirement for my degree, and chose C++. However, the courses are offered in a different campus that is further away from where I take my other courses. It's also offered as an online course, and I thought that maybe I can do that. I studied Turbo Pascal in high school and was quite good at it. I still remember all of the concepts of programming, so I have a feeling that taking C++ online won't be such a problem.

Is that a mistake? I thought about trying it online, and if it's too hard I'll just ask to take in class. I know that it sounds like I've already decided to take it online, and in fact I did, but if it's a big mistake then I'll reconsider.
 
  • #23
C++ is going to be a LOT more of a problem to learn than Pascal (which is type safe). I highly recommend that you go to the class.
 
  • #24
If it's a technically introductory course, and the first such course you've had in awhile... I wouldn't take chances. It can be very useful to have the teacher right there to ask questions of. This is assuming you have a half decent teacher.
 
  • #25
rootX said:
I found C very easy after I learned assembly language.

I'll ditto that. With C it is very important to understand what is happening, rather than how to code. Once you understand what all these concept are, you will semi-master C:

What is a variable? If you say int x = 2, where is that 2 stored? What if you say x = y, what is going on in memory or registers?

What does it mean to declare a pointer? What is difference between a reference (variable) and a pointer. What does a pointer store?

What is the meaning of static keyword for variables. What about functions?

What is stack and heap

What is the scope of every function and/or variable in the program.
 
Back
Top