1.实现一下i++与++i
//++i
int& int::operator++()
{
*this +=1;
return *this;
}
//i++
const int int::operator(int)
{
int oldValue = *this;
++(*this);
return oldValue;
}
2.请你来写个函数在main函数执行前先运行
_attribute_((constructor)) void befor_main()
{
printf("before main\n");
}
3.strcpy实现
char* strcpy(char* strDest,const char* strSrc)
{
assert((strDest!=nullptr)&&(strSrc!=nullptr));
char* address=strDest;
while(*strDest++ =*strSrc++ !='\0');
return address;
}