I
I
Ilya Pavlov2015-03-22 19:52:58
Arduino
Ilya Pavlov, 2015-03-22 19:52:58

Why is there an invalid conversion from 'char' to 'char*' error?

Here is the code:

char *val[] = {"xxxxxxy", "yxxyyyy", "xxyxxyx", "xxxxyyx", "yxxyyxx", "xyxxyxx", "xyxxxxx", "xxxyyyy", "xxxxxxx", "xxxxyxx"};
char *a = val[0];
char *b = a[0];

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
ManWithBear, 2015-03-22
@PiCoderman

val - array of strings = array of arrays of characters
a - string = array of characters
b - character
char b = a[0];

A
Armenian Radio, 2015-03-22
@gbg

That's right - the array a is single characters, not pointers to characters.
char *val[] - array of pointers to a character - char*
char* - array of characters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question