How to add chars in C?
<p>So this is my code:</p>

<pre><code>#include&lt;stdio.h&gt;
int main(){
char username[100];
int password, i;
char temp;

printf("Enter username: ");
scanf("%s", username);
for(i=0;i &lt; strlen(username);i++){
    printf("\n%d", username[i]);
    temp = username[i];
    password = password + temp;
}
printf("\n");
printf("Your password: %d", password);
return 0;
}
</code></pre>

<p>I know its a bit messy. I've spend HOURS trying to find out why this doesn't work, whereas this does:</p>

<pre><code>#include&lt;stdio.h&gt;
int main(){
char r = 'r';
char a = 'a';
char f = 'f';
int i;
i = r + a + f;
printf("%d", i);
return 0;
}
</code></pre>