(Read 200 times)
Mar 23, 2019, 03:57 am
Do I have to learn both C and C++ languages in order to learn arduino programming
Hi there this is vaibhav new to arduino. If I make any mistake i request you to forgive me
Mar 23, 2019, 07:14 am
The .ino files of Arduino sketches are compiled as C++, after a small amount of preprocessing that I already described in
your previous thread related to this topic
Most Arduino libraries are written in C++. There are some libraries which contain C code, but when you use these libraries in your .ino file, you will be interfacing with them as C++.
Although every Arduino sketch must contain a .ino file, which is essentially C++, you can add C or assembly files to a sketch if you want to incorporate some code written in those languages. This is very rarely done.
So the value of knowing C really depends on how deeply you want to dive into Arduino. If you only want to write sketches, you can easily get by with only C++. If you want to be able to dive into any given library's source code and understand every bit of it, then understanding C will be useful.
Keep in mind that C is a subset of C++. When you learn C++, you're also learning C. The only thing you will lack is the understanding of which parts of C++ are not supported by C. So if you have a good understanding of C++, you will be able to look at C code and understand it. You might just wonder "why didn't they do such and such", when the answer is "because that's not supported in C".