Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

checksum

2007-03-13 by magzky02

i would like to get the sum of values of characters in a string. I 
use to get the checksum.

ex.
strcopy(string1, "abcdefghigklmnopqrstuvwxyz");

this does not work:

sum=0;
for (i = 0; i < strlen(string1); i++)
{
sum = sum + string[i];
}

but this works:

sum = string1[0] + string1[1] + .... + string[25];

but is too lengthy to do the later method.
is there any shorter method to get the sum of values in a string? 

regards

mago

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.