c++ - Difference between initializing a C-style string to NULL vs. the empty string -



c++ - Difference between initializing a C-style string to NULL vs. the empty string -

are these 3 equivalent:

char* p= null; char* q = ""; char r[] = {'\0'};

i suspect first 1 different rest, i'm not exclusively sure.

char* p = null;

this assigns null pointer p means p not point valid memory address.

char* q = ""; char r[] = {'\0'};

these both create empty strings , equivalent. q points valid memory address, unlike p in previous example. r array empty string.

c++ c string

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -