#define HEADER_SIZE 32
char msg[32];
void incr_ref(char*& ptr) { // reference to pointer
ptr++;
}
char* incr_ret(char* ptr) {
return ptr + 1; // or return ++ptr;
}
char a = 'a';
char b = 'c';
void incr(char** ptr) {
(*ptr)++; // increment the pointer that ptr points to
}
char header[HEADER_SIZE];
void storeHeader(char** ptr, char* h) {
memset(h, '\0', HEADER_SIZE);
while (*ptr && **ptr != '\n')
*h++ = **ptr, (*ptr)++;
if ((*ptr)[0] == '\n') (*ptr)++;
}
void setup() {
Serial.begin(9600);
uint8_t n;
n = (a == 'a') ? ((b == 'b') ? 2 : 1) : 0;
Serial.println(n);
/*
strcpy(msg, "hello\nworld");
char* txt_buf;
txt_buf = msg;
Serial.print("buffer: '"); Serial.print(txt_buf); Serial.println("'");
storeHeader(&txt_buf, header);
Serial.print("buffer: '"); Serial.print(txt_buf); Serial.println("'");
Serial.print("header: '"); Serial.print(header); Serial.println("'");
*/
/*
strcpy(msg, "hello");
char* str = msg; // str points to "hello"
Serial.println(str);
incr(&str); // pass address of str
Serial.println(str);
incr_ref(str);
Serial.println(str);
str = incr_ret(str);
Serial.println(str);
*/
}
void loop() {
// put your main code here, to run repeatedly:
}