I just want to somehow calculate the sum of the chars in the array by changing them into variables (c = 2, d = 3), in this case it should be 12 ie: (c + c + d + c + d) = (2 + 2 + 3 + 2 + 3). How can I do this? I need something to add to this code.
#include <iostream>
using namespace std;
const int c = 2;
const int d = 3;
int main()
{
char s[5] = {'c', 'c', 'd', 'c', 'd'};
int j = sizeof(s) / sizeof(s[0]);
int k = 0;
for (int i = 0; i > j; i++)
k += s[i]; // end result should be 12
}