wrote:
> Hi All
>
> What is difference in
>
> TCHAR myVar[]=.....;
> and
> TCHAR *myVAR1=(TCHAR *)malloc....;
>
> arent both myVar and myVAR1are same?
No, arrays and pointers are not the same. I many cases you can use them
the same way, but that does not make them the same.
Here's one difference
myVAR1 = myVar; // legal, myVAR1 now points to the start of the array
myVar = myVAR1;// illegal, doesn't compile
The other big differences are that you have to to remember to free the
myVAR1 memory using free, and that you can allocate different sized
memory blocks using malloc, but an array is a fixed size.
>
> what difference would it make if i typecast myVar as (TCHAR *)myVar?
Very little.
>
> -Ajay
>
Suggest you read a book on C or C++.
john