字符串拷贝实现

char* StringNCpy(char* dest, const char* source, unsigned int n)
{
     
	char* temp = dest;
	while (n--)
	{
     
		if (*source != 0)
			* dest++ = *source++;
		else
		{
     
			*dest = *source;
			break;
		}			
	}
	return temp;
}

你可能感兴趣的:(c++)