in C Is it possible to use a character as an array subscript

in C ,Is it possible to use a character as an array subscript? And why?

Solution

No you cannot use a character as an array subscript as an integer is signed but a char does not have to, so it give a warning or an error if you use character as an array subscript.

And if still you want to use array as a subscript so don’t use

char i;

use unsigned char

unsigned char i;

This will solve the problem.

Thank You for using Chegg...

in C ,Is it possible to use a character as an array subscript? And why?SolutionNo you cannot use a character as an array subscript as an integer is signed but a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site