+ 3
What is the meant by char* p= new char[0]; ?
I recently saw a code with a char pointer was initialised like char *str= new char[0]; But I can't understand why it is possible and what is its use?? Please help
5 Respostas
0
this is a pointerto a character and 0 marks the end of a string. this is an array of strings which are terminated by the value null, its memory adress pointer is marked with null.
0
Declared a string pointer variable *str and initialized it with char[0] element.
0
Nur MD Bijoy (Rohan) according to your answer a pointer is initialised by a char!!
[0] is the size of array here
0
Buhle so now str ==nullptr ?
Or (*str) == '\0'?
0
Vedansh this is gonna be the initial index