正在加载图片...
Pointer Arithmetic the only legal; arithmetic operators on pointers are adding and subtracting an integer, or subtracting one pointer from another p is &t[o], q is &t[3], then g-p is 3 how to find t[n/2 suppose, minptr points to the array' s first element maxptr points to the array s last element ((minptr+maxptr )/2)is illegal as adding to pointer is not allowed how about (minptr+(maxptr-minptr)/2) as(maxptr-minptr)/2 is an integer PROGRAM MINGMETHDOLODGY AND SOFTWAREENGINEERING 港城市大 Copyrighto1998 Angus WuPROGRAMMING METHDOLODGY AND SOFTWARE ENGINEERING Copyright©1998 Angus Wu Pointer Arithmetic • the only legal; arithmetic operators on pointers are adding and subtracting an integer, or subtracting one pointer from another p is &t[0], q is &t[3], then q-p is 3 how to find t[n/2] suppose, minptr points to the array’s first element maxptr points to the array’s last element *((minptr+maxptr)/2) is illegal as adding to pointer is not allowed. how about *(minptr + (maxptr-minptr)/2) as (maxptr-minptr)/2 is an integer
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有