Why on earth am I getting access violations from the following two prorams, the first is using strcat(), and the last one is using strncat()....
// code
#include <iostream.h>
#include <string.h>
int main()
{
char *FName = "John";
char *LName = "Doe";
strcat(FName, LName);
cout << FName << endl;
return 0;
}
// code
#include <iostream.h>
#include <string.h>
int main()
{
char *FName = "John";
char *LName = "Doe";
strncat(FName, LName, 3); // will only print the first 3 char's
cout << " " << FName << endl;
return 0;
}
any ideas?