This is the specific section of code where I am facing issues using both strcat()
and strncat()
functions to concatenate two strings.
The strcat()
function is declared as char *strcat(char *dest, const char *src)
and strncat()
as char *strncat(char *dest, const char *src, size_t n)
, however both of them give issues when the second parameter is a single character from string, i.e., which does not end with '\0'
. I need to concatenate the a character to a string.
So is there any alternative to these two functions or is there any way to make these functions work for me?
char *cipher_str = (char *)malloc(sizeof(char) * 26);
for (int j = 0; j < col; j++) {
for (int i = 0; i < col; i++) {
if (min == cipher[0][i] && (done[i] != 1)) {
done[i] = 1;
for (int k = 0; k < rows; k++)
strcat(cipher_str, cipher[i][k]);
}
}
...