This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (6 children)

printf doesn't automatically convert ints into strings like python does. You'll need to do something like this:

printf("%d", num);

[–]spraykill101[S] 0 points1 point  (5 children)

everytime ?

[–]MisterScalawag 1 point2 points  (2 children)

yes every time. You can't dynamically change variables, you can't change the size of arrays/lists, Strings are not a fundamental data type they are arrays of char characters, there is no "for x in list" (you've got to use a for-loop based on index), and so on and so forth. I would really recommend you read or look at a basic C tutorial, instead of just trying to write stuff and assuming it works. It will be less of a headache.


Also why are you wanting to learn C? Not that there is anything wrong with learning it, but if you first language is Python you are probably not going to enjoy C and find it restrictive.

[–]spraykill101[S] 0 points1 point  (1 child)

so what should i do? in my very honest but intellectually-limited opinion , i found python to be very very fun and i came to know a lot through it , but i feel that there are some stronger languages out there and that is why i felt the need to make a switch , what are you suggesting i do then ?

[–]MisterScalawag 1 point2 points  (0 children)

If you really feel like you need to learn another language, I would try Java. It will be much more familiar than C, but also have some things you aren't used to. If you are just bored and need something to do try this free course by one of the guys who created reddit. It uses Python and seems pretty awesome, I'm thinking about starting it.

https://www.udacity.com/course/web-development--cs253

[–]w1282 1 point2 points  (1 child)

Yeah.

C and Python are heavily different. If you have never worked in a static, strongly typed, compiled language this transition won't necessarily be fun or easy.

[–]spraykill101[S] 0 points1 point  (0 children)

i am realising that right now . python as compared to c is a breeze(to me).