String in function declaration throws error?

I was trying to create a function which should have a string as parameter.

int UserMail(string typ) { // STILL EMPTY NOW }

Gives the Error: error: 'string' was not declared in this scope


string typ = "abc";

as normal declaration outside if the function is working.

SInce I cannot find an mistake why isn't it working? Can you only use Char arrays in functions?

Did you mean "String" ?

So it has to be capital S?

Arduino marks it as variable type by cyan color as well if i write it with lowercase S

Or use a char pointer ;)

guix: Or use a char pointer ;)

Well, that goes without saying, but for someone who is unclear about case-sensitivity, C-style strings are probably next week's topic.

Thats not the point!

If Arduino IDE marks "string" as variable this must be an bug in the IDE!

If "String" (as I found now the function) is the only correct way "string" should not be marked in cyan like other variables.

Just because of this I couldn't make sense of the Error and didnt stumble over the IDE doesn't recognize"string" as variable type!

If Arduino IDE marks "string" as variable this must be an bug in the IDE!

Just because something snuck unchecked into the keywords file is no reason to shout "Bug!".

Personally, I mostly ignore text highlighting, just like the compiler does.

A bug is somethig which isnt intended to be as it is.

So where’s the problem with that word?

Anyway… No need for further discussion we solved the mystery.

Just take this line out of hardware/lib/keywords.txt:

string	LITERAL1	string	RESERVED_WORD_2