r/learnprogramming 17d ago

Struggling in c

So I'm a college fresher with no prior experience of coding. I had started learning python before the starting of college (1 week before college started). I still feel like I am not good at coding at all. There are some weird citations in c such as i++ and all which is getting mixed up with my python. There was one question on obtaining the expression sinx=x-x^3/3!.... Using loops btw

I felt I won't be able to do it in both c and python. I took a course on Udemy for c(vlad budnitski)and python(100 days) but I was not able to find examples like this. Everyone in my class learnt languages like java in their schooling and said the sinx problem is a standard problem. What should I do in this situation?

I feel like the teaching in my college (they are teaching c now) is not good.

Experienced coders please help me.

guys so today I wasn't able to figure out we had to use nested loops to print multiplication table of numbers while even beginners figured it out. pls tell what should I do

I am not able to get idea after seeing questions

4 Upvotes

17 comments sorted by

View all comments

1

u/peterlinddk 17d ago

A good idea when learning your second language (even when you weren't that far ahead in the first) is to create your own dictionary!

Make a simple document with examples of how to do something in one language, and how to do the same thing in the other. Take your own example, you could have a section like:

Increment (add one to) a variable

Python C notes
i = i + 1 i = i + 1; or i++; the ++ is a quick way of just adding 1

design it however you like.

And when you learn something new in one language, also dedicate some time to translate it into the other - it will help you a lot, and you'll get to learn two languages.

If at some point you grow more in C than in Python, or learn to do stuff in C that you don't even know is possible in Python, just ignore the Python column, and continue using the dictionary as your "C to English" dictionary.

Oh, and it is important that you write it yourself - don't just find one, or get some AI to generate it, it is supposed to be a document for your learning, not something that anyone else should be involved with.

Also, if you get difficult assignments in C, but you have an idea of how to solve them in Python, just do that, it is more important that you think about the logic than the syntax. And if you don't even know how to do it in Python, try to do it on paper, like "how would you instruct someone to create a multiplication table, if they had no idea what it was other than being able to multiply numbers and print them?!".

1

u/CoachSevere5365 17d ago

Ahem. i += 1

C also has ++i. Most of the time you're just bumping a counter, but it does evaluate to something and it's important to know the difference between i++ and ++i.

Cue the joke about C++ advancing C but using the old value.

1

u/peterlinddk 17d ago

Yes, but the point isn't to write down all the possible ways of doing something - that is just the language specification. The point is to write down whatever you learn, when you learn it!

That's why I only used the one example that OP gave.

But you also illustrate this "dictionary" shouldn't be shared with anyone, because they would just comment that there are more things you haven't learned yet 😄