Re: signed/unsigned char

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Milena,

> char* c = new char(1024);

This allocates a single character, initialized with the value 1024.  (Since 1024 is bigger than what a char can hold on most systems, it will get sliced.)

>I know that the correct form of this memory allocation is "[1024]" and not "(1024)" but sometimes it occurs by mistake.

Both forms are correct.

You can allocate an array of char.

You can allocate a single char.

>The compiler is not supposed to complain about it???

No, there is nothing to complain about.  You are allowed to allocate a single object.

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux