#include<stdio.h>
int main(void) {
// your code goes here
int a[10],i,j;
char b[10];
scanf("%s",b);
for(j=0;j<10;j++)
{
printf("%c\t",b[j]);
}
for(i=0;i<10;i++)
{
a[i]='b[i]';
printf("%d\n",a[i]);
}
return 0;
}
#include<stdio.h>
int main(void) {
// your code goes here
int a[10],i,j;
char b[10];
scanf("%s",b);
for(j=0;j<10;j++)
{
printf("%c\t",b[j]);
}
for(i=0;i<10;i++)
{
a[i]='b[i]';
printf("%d\n",a[i]);
}
return 0;
}
A simple google search could have solved it also.
In C language, you donβt need to put β β to typecast, you can just do,
a[i] = (int)b[i]
and since char is implicitly also promoted to int you may simply write
a[i] = b[i]
To know more about C datatypes type conversion, you can read here
I hope that answers your question
thanks a lot!!!