You can't get the input value directly through (int) a.
The values you enter are assigned to an array of strings one by one, for example, 12.
Where a[0] = 1
a[ 1]= 2; A[2]='\0', where' \0' indicates the end of the string.
This is how it is stored.
You can do this:
# include & ltstdio.h & gt
# include & ltmemory.h & gt
void main()
{
Printf ("Please enter a string: \ n");
char a[ 100];
memset(a,0, 100);
scanf("%s ",a);
for(int I = 0; A [me]! =' \ 0'&me< 100; ++i)
{
printf("%d ",(int)a[I]-48);
}
}
Memset is used to empty an array of strings.