2.1 [4 marks] Given a string str, we can calculate a checksum of the string by summing up the ASCII codes of the characters i

2.1 [4 marks] Given a string str, we can calculate a checksum of the string by summing up the ASCII codes of the characters in the string. For example, the checksum of a string ‘apple” is 530, which equals to ‘a’ + ‘p’ ‘p’ + ‘1’ + ‘e’ = 97 + 112 112 + 108 + 101 Write a function int calculate_checksum (char str[]) that calculates and returns the checksum of the string str.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *