The following program is converting alpha-numeric phone number to numeric. The problem i am having is that it is giving me a link error and i am not sure why. Can anyone help out Thanks.
Code:
#include <stdio.h>#include <ctype.h>
#define SIZE 30
void convNum( char *phoNum)
{
int x=0;
phoNum[SIZE];
printf("Enter the phone number:");
while (gets(phoNum)!=NULL)
{
switch(toupper(phoNum[x]))
{
case 'A':
case 'B':
case 'C':
phoNum[x]=2;
break;
case 'D':
case 'E':
case 'F':
phoNum[x]=3;
break;
case 'G':
case 'H':
case 'I':
phoNum[x]=4;
break;
case 'J':
case 'K':
case 'L':
phoNum[x]=5;
break;
case 'M':
case 'N':
case 'O':
phoNum[x]=6;
break;
case 'P':
case 'Q':
case 'R':
case 'S':
phoNum[x]=7;
break;
case 'T':
case 'U':
case 'V':
phoNum[x]=8;
break;
case 'W':
case 'X':
case 'Z':
phoNum[x]=9;
break;
}
for (x; x<SIZE; x++)
{
printf("%c", phoNum[x]);
}
}
}