Sitemap
Martinsoft

Hello! Welcome to the Martinsoft blog! We share tech news, mobile app development stories, and help to make tech less daunting.

Learn a Language: C/C++

5 min readAug 27, 2018

--

Learning to code requires a HUGE investment of time and energy. For newcomers it’s also difficult to know where to start because there are so many languages to choose from. Through my Instagram account I’m often asked:

“Which programming language should I learn?”

I wanted to be able to give a better answer than “it depends”, so with this Learn a Language series, I hope to build a resource that’ll help people decide for themselves which language they should invest their time in learning!

With help from other developers across the tech community, each article will give an overview of a popular programming language, from a developer experienced in that language. We’ll look at what each language is good at, what it’s not so good at, and the tools/resources that can help you get started.

In this article, Ryan Cornateanu aka @hackersclub gives an overview of C/C++!

Ryan aka @hackersclub

How long have you been working with C/C++?

I’ve actually only been working with C for the past one and a half years. So not that long! Before doing more low level security research, I was writing most of my security tools in Ruby, and/or Python.

What made you choose to work with C/C++?

After my work with Amazon, I became really really obsessed with the idea of reverse engineering. So I picked up a book on x86 Assembly & C, and just started writing compiler code from there. I was so fascinated by the inner workings of the kernel and how things worked from ROM to RAM to Kernel to User-Land.

What sort of things is C/C++ well-suited for? When should someone consider using C/C++ for their project?

C language can be used for all sorts of things! Say you want to create a driver that sends bluetooth information up to user-land using IOCTL (Input/Output Control) code, then C would be the perfect language for that!

Another one is electronics, MCU’s (Microcontroller Units) like Arduino use embedded-C for controlling hardware. Let’s say you want to make a motion sensor that triggers an API call every time someone passes by your front-door. That would require you to write C code that talks to the Arduino that then sends requests up to your network.

If you also know other languages, how does C/C++ compare to these?

Every language definitely does serve its purpose. I would never reinvent the wheel from what Python can do already in much easier steps. I’ll use C or C++ when its necessary for those hard to reach surfaces that Python or any other statically typed language can’t hit.

The difference is programatically, C/C++ is slow/hard to write and it is also very error-prone. Readability is paramount when working with teams, so your C code has to be very well documented. While Python is used to interface with high level performance libraries in a much more friendly way.

Are there any types of project / task that C/C++ would not be a good choice for?

Anything that is considered high level work that could be done using anything else haha! It’s about knowing what language to use for what scenario.

Example, I’d use assembly when I need the lowest level access to the hardware at my feet. Basically, if you need the rawest of control over your kernel or even user-land binaries. I would say almost the same thing for C/C++, you’ll spend so much of your time debugging memory and/or buffer issues than writing highly optimized code.

What do you particularly like about coding in C/C++?

To put it in a very short and sweet way… I really like watching code compile 😆… but yeah, for my line of work in Malware/Exploit Research & Development it really comes in handy.

What are the things that frustrate you when working with C/C++? What possible sources of pain or frustration (if any!) should people be aware of before they start learning C/C++?

It’s annoying as sh** to debug code. User-land binaries not so much if you are compiling with a debug flag, because in that case you can jump right to the line of code that causes your issues without having to look at the assembly.

Drivers are a whole other world though… especially for Windows because deploying a driver requires a lot of steps to get it on the virtual machine in the first place, and depending on what your driver does, you need another application to interact with it while your doing a kernel debug over a COM port.

Get John Martin’s stories in your inbox

Join Medium for free to get updates from this writer.

With embedded systems, its not as bad if you’re coming at it from a white-box approach. Most IDE’s these days like Keil or IAR Systems have great built in simulators for your ARM code.

What dev tools do you use when working with C/C++? What other tools are also popular?

I work a lot with:

There are so many tools out there that I could name drop, but these 7 would definitely be the most popular in my book.

Press enter or click to view image in full size
Ryan’s @hackersclub account is loaded with resources and tools if you want to learn more about low-level programming, hacking and debugging

Anything else you want to say about C/C++?

I know this sounds generic but don’t give up, and I sincerely mean that. I’m not exaggerating when I say even within a year if, like, you haven’t reached intermediate levels, that is pretty normal.

Compiler languages are complicated and not friendly whatsoever, so just give it time, and practice a whole lot.

Thank you so much Ryan! Where can people find you online?

Thank you so much for reading! I hope you found this article useful!

If you know C/C++ and have suggestions for other resources that beginners should know about, feel free to leave them in the comments!

Other languages will be coming soon!

You can find me:

Instagram: @martinsoft

Online: https://martinsoft.net

I also co-host @meetupandcode, a regular meet-up in London for devs with any level of experience. Join us!

--

--

Written by John Martin

Full-stack developer with a focus on iOS. Founder and freelance dev @martinsoft. Passionate about all things Apple, and using tech to make life better.

Published in Martinsoft

Hello! Welcome to the Martinsoft blog! We share tech news, mobile app development stories, and help to make tech less daunting.