Bank::Bank(char * name,char * account,deposit amount)
{
int x = strlen(name);
int y = strlen(account);
Customer_Name = new char[x+1];
Account = new char[y+1];
strcpy(Customer_Name,name);
strcpy(Account,account);
//strncpy(Customer_Name,name,x);
//strncpy(Account,account,y);
//Customer_Name[x+1] = '\0';
//Account[y+1] = '\0';
Amount = amount;
}
析构函数
Bank::~Bank()
{
delete [] Customer_Name;
delete [] Account;
}
如题,我用strncpy复制字符串,编译通过,运行就错误了,后来忙半天试试改成了strcpy,就可以了!
这是为什么呢,不才的很,百度了一圈没看出个所以然!
另外问一个问题,在vc上面如果出错了,要进行调试,有哪本书是专门讲关于调试的知识呢,小弟自学者,很烦恼,只会F9,F5,每次看其他朋友的帖子,一堆的调试截图,看不明白啊,想学!