I am stuck on the same code for quit some time now. I am trying to fill a char array with characters i read from a text file (ascii). But for some reason when i printf the char array it only displays the letter H.
Code:
void append(char c)
{
//int len = strlen(cStr);
cStr[iCounter] = c;
cStr[iCounter + 1] = '\0';
printf("char c:%c char array%c\n",c,cStr);
}
The char array (cStr) is declared outside this function because i need to acces it from different functions. So is iCounter which is incremented every time it executes this function.
Any help would be appreciated.