The program I'm trying to write has a value for each letter in the alphabet. When someone enters a word I want to be able to total each letter in the word up and show a total value for the word. I was wondering if i was on the right track. I'm just trying to test it out and no matter what letter I put in I get the same answer of -64. This is what I have so far.
#include <stdio.h>
int main()
{
char word[100];
int a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7,
h = 8, i = 9, j = 10, k = 11, l = 12, m = 13, n = 14, o = 15;
printf("Enter a word\n"
scanf("%s", word);
if (word[100] != 'NULL')
printf(" is %d\n", word[100]);
return 0;
}
#include <stdio.h>
int main()
{
char word[100];
int a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7,
h = 8, i = 9, j = 10, k = 11, l = 12, m = 13, n = 14, o = 15;
printf("Enter a word\n"
scanf("%s", word);
if (word[100] != 'NULL')
printf(" is %d\n", word[100]);
return 0;
}