restirct的用法
int *restirct restar=(int*)malloc(10*sizeof(int));
for(n=0;n<10;n++)
{restar[n]+=5;restar[n]+=3;
}
这里restar是唯一一个可以访问malloc分配的内存的方式,用restict限定了以后,编译器会认定只有restar可以访问,就会将for语句里的两行代码变为restar[n]+=8,以此来提高编译器的效率。
****可以将限定符放在变量后的方框中
void ofmouth (int * const al, int * restrict a2,int n);可以由下式替换
void ofmouth (int * al[const],int a2[restrict],int n);
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
