Does Arduino use C or C++?

C++CArduino

C++ Problem Overview


I see in one place that Arduino uses 'standard' C, and in another that it uses 'standard' C++, so on and so forth.

Which is it?

C++ Solutions


Solution 1 - C++

Arduino sketches are written in C++.

Here is a typical construct you'll encounter:

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
...
lcd.begin(16, 2);
lcd.print("Hello, World!");

That's C++, not C.

Solution 2 - C++

Both are supported. To quote the Arduino homepage,

> The core libraries are written in C and C++ and compiled using avr-gcc

Note that C++ is a superset of C (well, almost), and thus can often look very similar. I am not an expert, but I guess that most of what you will program for the Arduino in your first year on that platform will not need anything but plain C.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmemilanukView Question on Stackoverflow
Solution 1 - C++user1157391View Answer on Stackoverflow
Solution 2 - C++tiwoView Answer on Stackoverflow