My program gets "segmentation fault" in "strcat(string,stringaux)" and it is strange because I am sure that string always has space for adding the new stringaux due to before call strcat I check if size of the destiny plus new stringaux is less than string capacity:
char string[100];
char stringaux[3];
void Function()
{
if ((strlen(string)+strlen(stringaux))<100)
{
strcat(string,stringaux)
}
}
In this way strcat() never can make string be longer than 100. But still I get SEGMENTATION DEFAULT.
I have been reading, and the explanation can be that the Stack gets full due to I have many local variables or ...
Is there anybody can tell me some ideas about why SEGMENTATION DEFAULT is produced in strcat() when I am sure that is not because there is not space in the destiny string?