hello
I am very new to C++ (and C) so i need something to clear up.
if you write
char ch[40];
you can uste it to store null terminated strings with length of 39
chars ascII.
if you code
char *ch;
what is the length of the n.string you can handle, for a 16bit
compiler like Turbo C++ 2.0?
is it 254 + zero termination?
will an omission to write a 255+ string corupt other variables space?
how do i print the address of a char variable?
char c;
cout << &c; will do the same as trying to write out a string since &c
is pointer to char.
and please one more thing. what is happening here.
#include <iostream.h>
char ch;
char *cp;
int main()
{ cp = &ch;
cp = "hello"; // i think this changes the point address of
the pointer but where ?
cout << ch << endl;
cout << cp << endl;
ch = 'u';
cout << ch << endl;
cout << *cp << endl; // strange?
cp = &ch;
cout << *cp << endl; // this is what i expect
return 0;
}
thanks in advance.
Vasko