pointers
Gordiano
sagrav@racsa.co.cr
Sat May 12 02:25:00 GMT 2007
What's wrong here?. I did the same with an integer pointer and it
works...
Target: i486-linux-gnu
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
=======================================================
// 11/05/2007 *** pointers ///
// se compila con: g++ -Wall ptr3.cc -o ptr3
// se corre con: ./ptr3
#include <iostream>
using namespace std;
int main ()
{
// ptr3.cc
char *c_ptr;
char ch;
c_ptr = &ch;
*c_ptr = "hello";// :( ptr3.cc:17: error: invalid
// conversion from âconst char*â to âcharâ
cout << ch << " is at memory location " << &ch << endl;
return 0;
}
=======================================================
thanks for help.
Rafael
www.astrocosas.com
More information about the Gcc-help
mailing list