 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert character array to string in Arduino
In order to convert a character array to a string, the String() constructor can be used. An example is shown below −
Example
void setup() {
   // put your setup code here, to run once:
   Serial.begin(9600);
   Serial.println();
   char buf[10] = "Hello!";
   Serial.print("Char array: ");
   Serial.println(buf);
   String s = String(buf);
   Serial.print("String: ");
   Serial.println(s);
}
void loop() {
   // put your main code here, to run repeatedly:
}
The output of the Serial monitor is shown below −
Output

Advertisements
                    