c++ - The difference between 0 and '0' in array -


i have question array initialization

what difference between

char a[6]={0};

and

char a[6]={'0','0','0','0','0','0'};

how compiler interpret above 2 expression? same or not??

'0' ascii character number 0. value 48.

the constant 0 zero byte or null byte, written '\0'.

these 4 equivalent:

char a[6] = {0}; char a[6] = {0, 0, 0, 0, 0, 0}; char a[6] = {'\0', '\0', '\0', '\0', '\0', '\0'}; char a[6] = "\0\0\0\0\0"; // sixth null byte added automatically compiler 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -