I want to convert a digit's spelling to an integer using C.For example "one" => 1,"two"=> 2 etc.I wrote the following program but it's not working.
#include<stdio.h>
#include<string.h>
void main()
{
int a=0,iplen=0,j=0;
char *num[]={"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
char input[100],*temp;
scanf("%s",input);
iplen=strlen(input);
for(int i=0;i<iplen;i++)
{
temp[j]=input[i];
j++;
}
for(int i=0;i<10;i++)
{
if(temp==num[i])
{
a=i;
break;
}
}
printf("\n%d",a);
}