Three Things Gained When Starting With C Instead of Python

When struggling with C pointers turns out to be beneficial

Brett Fazio
Feb 26 · 4 min read
Photo by Shahadat Rahman on Unsplash

The common route taken by beginner programmers these days is to start with a scripting language with easier syntax and then branch out from there. Python and Javascript are two such languages that are very popular among beginners and experienced professionals alike.

While a language like Python is extremely powerful and has many use cases in the industry, a language like C is a better, but not easier, place to start.

No one will argue that it will be easier for a programmer or Computer Science student to start off with C than it is with Python — it most definitely is not. But, later into your career starting with a language like C could provide a better foundation on which to build. I’ll discuss a few reasons why I think this is the case.

More Rigid Syntax

If you’ve used both C and Python you’ll know what I mean when I say that C’s syntax is more rigid than Python’s. With both, you have to follow a set of rules but overall C’s rules are more strict.

If you look at line endings, C requires semicolons while Python does not. C requires if statement conditions to be surrounded by parentheses while Python does not. C has the idea of pointers while Python handles that all for you.

This isn’t a knock on Python — in many ways, it’s a benefit allowing one to get their production code up and running faster. But for someone starting out, having a solid set of rules that you think about when typing, rather than the lackadaisical rules of Python, will set you up better when you learn a new syntax or when writing code generally.

Lower-Level Understanding

I previously mentioned that C has the idea of pointers while Python handles a lot of that for you.

C gives a much lower level understanding of what’s actually going on in your code as opposed to many scripting languages and even compiled languages like Java.

When writing C code you’ll really get a feel for what's going on in the memory as you’ll have to think about allocation, deallocation, and memory scope. In other languages, you can just create variables whenever you want and pass them wherever you want without much thought. Often this will work fine in simple programs, but when you start to get into more complex programs in any language, it will become very useful to really understand what is going on with your variables.

Idea of Type

In Python you do not give a type to a variable when it is created — you simply just set it to the value and the type is assumed under-the-hood. This is, again, a speed improvement for those experienced, they already know what types they need and want to set up their variables as fast as possible.

For a beginner, it's a good idea to think about variables in terms of their type. A beginner may become confused that there’s no distinction between a String and an Int in Python, as you just set both with an equals sign.

With C, in order to declare any variable, you must assign a type. This gives you a clearer understanding of what your variables actually are so your code and remains as clean and usable as possible.

One area where a beginner would become particularly confused in Python is when dealing with larger libraries such as numpy or pandas. As they go about using variables from types defined in those libraries and calling functions in those libraries, it is very easy to get lost in what all of the variables actually are and what the functions really take in and provide. This is a cause for confusion. Because one is getting lost in using the libraries they may stop worrying about understanding what is actually going on and try instead to just get the program to work. This is a bad approach. You should always try to understand what’s going on at a lower level in your code. It could just be a type error that’s causing it, and in a language like C, it’s much easier to tell what each of your types are and what each function requires as parameters.

Future Learning Ability

With those three ideas in mind — rigid syntax, type, and lower-level understanding — it is easier to move to a new language starting with C than it is with Python. I believe this is due to the direction of movement. If you start with C, a rigid language, it is easier to become more relax and move to other languages. And if those new languages happened to have a hard syntax also then you already know how to cope with that because of your C knowledge.

If you start with Python, a more relaxed syntax, it is harder to add that rigidity on the fly. You’ll likely try to figure out how to do all these Python one-liners in languages that really aren't designed for that. As a result, that transition may be slightly harder.

At the end of the day, if you’re learning any programming language at all that's a great start. However, if I could make a recommendation to a new programmer it would be to start with a compiled language (like C) over a scripting language (like Python) for all the reasons I’ve mentioned so far.


Everything connected with Tech & Code

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store