Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to assign the value of integer variable to the elements in character array in C language?
How to assign the value of integer variable to the elements in character array in C language?
b[0][0]= a+' 0 '; & ltp> doesn't matter, but it is only used in the case of 1 digit, because there are only 0-9 ASCII codes in the ASCII code table, and their' 0' value is much higher than normal, which is 48.

The easiest way to understand the initialization of character arrays is to assign each element in the array one by one.

char str[ 10]={ 'I ',' ',' a ',' m ','

,' h ',' a ',' p ',' p ',' y ' };

That is, 10 characters are assigned to str[0] to str[9] 10 elements respectively.

If the number of characters provided in braces is greater than the length of the array, it will be regarded as a syntax error; If it is less than the length of the array, only the first element and the remaining elements in these character arrays are automatically designated as empty characters (i.e.

'\0' )。