Getting a char from a string

I have this problem that I don't know how to sort out. I have a feeling it's really simple, but I can't put my finger on what I'm doing wrong.

#include <iostream>
#include <string>

void main () {
char test[10] = "gorilla";
char try = test[1];
cout << try;

I get the error:
lab4.cpp:6: error: expected primary-expression before "char"
lab4.cpp:6: error: expected `;' before "char""
You are using C++ keyword try as a variable name. Change this identifier to something else.

Also main shall be declared as int main() and cout shall be wriiten as
Thanks I hadn't realized that it was a kyword.
Topic archived. No new replies allowed.