I was asked by someone to give comments on some java statements. The statements and my comments are as under. I thought well before answering and also verified by making a small program. But I was told that I was wrong.
I can�t figure out which comment is incorrect.
char string ;
This is an invalid array declaration. You will get a compiler error.
char *arry; arry = new char;
These are two statements. I will break them up.
*arry is an invalid identifier. You will get compiler error.
Since arry has not been declared anywhere so again the code will not
If arry had been declared as an array of type char, then this statement
would have created a char array of length 256. But this is not the case.
No 2: This is how you declare a character pointer, and then allocate an array of 256 characters from the heap, in C++;
My comment would be... get a C++ compiler and these instructions will compile fine...
[ May 06, 2005: Message edited by: Henry Wong ]
Originally posted by Giovanni De Stefano:
Mmmm...let's see...I thought the name of this community was JAVARANCH...WHAT'S GOING ON HERE???
I can tolerate C (I actually like it!) BUT I CANNOT STAND AT C++!!!
Please moderators, remove this topic!!!
If you read my post carefully, I was to give comments on "java statements". I did not know this was C++. This was weird java code indeed.