兆芯 C/C++ 在线笔试
6道选择2道填空1道编程。
编程:
编程实现内存移动操作:
#include <stdio.h> #include <stdlib.h> void * myMemMove(void* dest, const void* src, size_t count) { } void main(void) { char s[] = "Test Memory Move"; char * t = (char *)malloc(40); t = (char *) myMemMove(t, s, sizeof(s)); printf("t:%s\n", t); myMemMove(t+10, t+5, sizeof(s)); printf("t:%s\n", t); myMemMove(t+8, t+16, sizeof(s)); printf("t:%s\n", t); free(t); } 测试输出: t:Test Memory Move t:Test Memoryemory Move t:Test Mem Move题目比较简单,提供的测试代码真是无力吐槽,另外,第二个测试输出好像有点问题?