| re: basic data types
"Paras Sharma" <parsharm@cisco.com> wrote in message
news:3F3889D0.5000009@cisco.com...[color=blue]
> Hi
>
>
> Does compiler generates classes for basic data types also ?? or it is
> just same as calling malloc[/color]
I think you mean does the compiler initialise built in types when calling
new. The answer is maybe. In your example 1 below, the allocated char is
initialised, in your example 2 the allocates chars are not inituialised.
[color=blue]
>
>
> What is the difference bwt 1) ^ 2) ..
>
>
>
> 1 )
> char * c = new char ( 4 ) ;
> delete c ;[/color]
This creates a single char and initialises it with the value 4
[color=blue]
>
> 2 )
> char * c = new char [ 4 ] ;
> delete [] c ;
>[/color]
This creates 4 uninitialised chars.
[color=blue]
>
>
> Can we use delete [] c in first examples .[/color]
No.
[color=blue]
>
> thanks
> Paras
>[/color]
john |