Unexpected results when I store integer value in 2D character array

As we know char datatype has the size of 1 byte i.e. it can store 0 to 255 integer numbers, alphabets & other special characters.

So when I store integer in single & double quotes then it shows correct output.

But when I store integer number without quotes then it shows unexpected output.

Can you explain this issue??

My Code(for better understanding of mu doubt) -> https://ide.codingblocks.com/s/351640

Also run this code in Sublime Test it given some other unexpected output.

Hey @Shivam01 the reason why you are not getting any output of arr2[3] is because you have stored character in arr2[0], arr2[1] and arr2[2] but now you are storing integer in your arr2[3] which is wrong. If you are declaring a character array then you can only store character in it, and if you have declared integer array then you can only store integers in it. You can store both of them as array can’t contain them. Hope this will help you :slight_smile:

Thank You for explaining Encoder!!