简体   繁体   中英

How to print char array from index n in Arduino

Let's imagine I have

String x = "hello there";

So I can print it from index eg 1 as:

Serial.println(x.substring(1));

ello there

I wanna do the same with

char x[] = "hello there";

Any ideas? (Except using loops to print char by char)

您可以使用 & 运算符来获取所需索引后的字符串,如下所示:

Serial.println(&x[1]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM