+ 1

Please show me the syntax for making an array of characters using "char mychar[]"

26th Dec 2016, 6:09 PM
smartguy100
smartguy100 - avatar
3 Answers
+ 5
char mychar[] = {'0', '1' , '2' , '3' };
26th Dec 2016, 7:17 PM
Wen Qin
Wen Qin - avatar
0
I have a question, why we do not give the array it's size in the square brackets? cause if we are assigning values to it then we know it's size @K2 Shape and @Vladislav
27th Dec 2016, 8:31 AM
Kourosh Azizi
Kourosh Azizi - avatar
- 2
char mychar[] = "example"; This code creates an array with length = 8(length of the word and null symbol '\n')
26th Dec 2016, 6:18 PM
Vladislav
Vladislav - avatar