Can anyone teach me how to find total ASCII value in a char array?
For example:
in the array contains: abc
it will esrach for ASCII value for a,b and c
then it will add up all the value
can anyone teach me this?
Can anyone teach me how to find total ASCII value in a char array?
For example:
in the array contains: abc
it will esrach for ASCII value for a,b and c
then it will add up all the value
can anyone teach me this?
Just add the values of the characters in the array:
This would be 97 + 98 + 99 or 294!Code:char array[] = "abc"; int total = array[0] + array[1] + array[2];
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
Code:char array[] = "abc"; int total=0, i; for( i=0; i < strlen( array ); i++) total += array[i];