随笔分类 - C,C++
摘要:Implement a function that performs binary addition. Input to the function is two const strings. The function returns a string that holds the result of addition. char* binaryadd(const char* a, const char* b) { }Eg. "1001"+"101"="1110"char* binaryadd(const char* a, const
阅读全文
摘要:[代码]假设数组的首地址为 0x100,则ptr1,ptr2,ptr3的值分别为多少呢?想偷懒的同学请潜到水底看答案!由于a为数组名,即也可表示为数组首地址,即a[0]的地址,所以 a+1为a[1]的地址;答案:ptr1 = 0x104&a为类型是int[5]的指针,所以&a+1就会加上5*sizeof(int)的长度;答案:ptr2 = 0x100+5*4 = 120int(a)+1答案:ptr3 = 0x101
阅读全文

浙公网安备 33010602011771号