深网站建设,大连网页设计培训学校,做网站业务员提成几个点,安卓优化大师手机版下载问#xff1a;1. ( )#xff0c;[ ]#xff0c;-#xff0c;#xff0c;--#xff0c;. #xff0c;#xff0a;的操作符优先级是怎么样的#xff1f;2. Solve the problems#xff1a;只有一个常量字符串与一个字符指针#xff0c;该怎么打印常量字符串所有内容…问1. ( )[ ]---. 的操作符优先级是怎么样的2. Solve the problems只有一个常量字符串与一个字符指针该怎么打印常量字符串所有内容3. 常量字符串在内存里面是怎么样的且怎么样如果相同常量字符串被应用很多次但内存里面怎么样4. 指针数组是什么5. 数组指针是什么经常应用在什么地方6. 二维数组的首元素是什么也就是什么二维数组的数组名是什么也就是什么因此就是什么7. Solve the problems已知一个二维数组想计算它的行数与列数并用数组指针打印二维数组该怎么办呀8. 函数指针是什么函数指针数组是什么函数指针数组的限制是什么9. Solve the problems想用转移表来写一个简易的整数加减乘除计算器该怎么写10. Solve the problems想调用0地址处的一个函数该怎么办呀11. Solve the problems想声明一个函数该函数的两个参数分别是整型和函数指针返回一个函数指针该怎么办呀12. 画一张图解释一下什么是回调函数13. Solve the problems有一堆整数我想排序一下怎么办14. Solve the problems有一些结构体我想按照不同成员分别排序一下怎么办15. 对于void可以用哪两个词语形容它16. qsort函数参数里面的比较函数的参数是什么返回值是怎么确定的17. Solve the problems我想用冒泡排序内核来实现qsort函数该怎么办18. 画出有关指针与内存等的思考框架图答1. ( ) [ ] - -- . 2. //解决方法
int main()
{char* p Elon Musk;int sz strlen(Elon Musk);int i 0;for (i 0; i sz; i){printf(%c, *(p i));}return 0;
}3. 连续存储的无法修改只会存一份。4. 存放一个个指针的数组。5. 指向数组的指针二维数组。6. 第一行一个一维数组首元素的地址一维数组的地址数组指针。7. //解决方法
int main()
{int arr[][3] { 1,4,5,2,3,4,5,1,2,7,9,7,5,0 };int row sizeof(arr) / sizeof(arr[0]);int col sizeof(arr[0]) / sizeof(arr[0][0]);int i 0;int j 0;for (i 0; i row; i){for (j 0; j col; j){printf(%d , *(*(arr i) j));}printf(\n);}return 0;
}8. 指向函数的指针存放一个个函数指针的数组每个函数指针指向的函数其“规格”要一模一样。9. //解决方法
int add(int x, int y)
{return x y;
}
int sub(int x, int y)
{return x - y;
}
int mul(int x, int y)
{return x * y;
}
int div(int x, int y)
{return x / y;
}
void menu()
{printf(******* 1. add 2. sub 3. mul 4. div 0. exit *******\n);
}
int main()
{int x 0;int y 0;int ret 0;int(*arr[5])(int, int) { 0,add,sub,mul,div };int input 0;do{menu();printf(请输入);scanf(%d, input);if (input 0){printf(退出成功\n);break;}else if (input 4){printf(输入错误重新输入\n);}else{printf(请输入两个操作数);scanf(%d %d, x, y);ret (*(arr input))(x, y);printf(结果为%d\n, ret);}} while (input);return 0;
}10. (*(void(*)())(0))();11. void(*signal(int, void(*)(int)))(int);12. 13. //解决方法
int cmp_int(const void* e1, const void* e2)
{return (*(int*)e1) - (*(int*)e2);
}
int main()
{int arr[] { 12,34,23,67,54,90,78,99,21,53,70 };int sz sizeof(arr) / sizeof(arr[0]);qsort(arr, sz, sizeof(arr[0]), cmp_int);int i 0;for (i 0; i sz; i){printf(%d , *(arr i));}return 0;
}14. //解决方法
struct Stu
{char name[20];int age;float score;
};
int cmp_by_score(const void* e1, const void* e2)
{return ((struct Stu*)e1)-score - ((struct Stu*)e2)-score;
}
int cmp_by_name(const void* e1, const void* e2)
{return strcmp(((struct Stu*)e1)-name, ((struct Stu*)e2)-name);
}
int main()
{struct Stu arr[5] { {wang,23,95.2} ,{ye,20,96.3} ,{shen,29,91.2} ,{hu,25,90.8} ,{Elon,51,99.9} };int sz sizeof(arr) / sizeof(arr[0]);qsort(arr, sz, sizeof(arr[0]), cmp_by_score);printf(按成绩排名\n);int i 0;for (i 0; i sz; i){printf(%7s %3d %.3f\n, (*(arr i)).name, (*(arr i)).age, (*(arr i)).score);}qsort(arr, sz, sizeof(arr[0]), cmp_by_name);printf(按姓名排名\n);for (i 0; i sz; i){printf(%7s %3d %.3f\n, (*(arr i)).name, (*(arr i)).age, (*(arr i)).score);}return 0;
}15. 瞎子垃圾桶。16. 相邻数组元素的起始地址根据要比较的实际数据大小确定。17.//解决方法
void Swap(char* e1, char* e2, size_t width)
{int i 0;for (i 0; i width; i){char tmp *(e1 i);*(e1 i) *(e2 i);*(e2 i) tmp;}
}
void my_qsort(void* base, size_t num, size_t width, int(*cmp)(const void*, const void*))
{int i 0;int j 0;for (i 0; i (num - 1); i){for (j 0; j (num - i - 1); j){if (cmp((char*)base j * width, (char*)base (j 1) * width) 0){Swap((char*)base j * width, (char*)base (j 1) * width, width);}}}
}
struct Stu
{char name[20];int age;float score;
};
int cmp_by_score(const void* e1, const void* e2)
{return ((struct Stu*)e1)-score - ((struct Stu*)e2)-score;
}
int cmp_by_name(const void* e1, const void* e2)
{return strcmp(((struct Stu*)e1)-name, ((struct Stu*)e2)-name);
}
int main()
{struct Stu arr[5] { {wang,23,95.2} ,{ye,20,96.3} ,{shen,29,91.2} ,{hu,25,90.8} ,{Elon,51,99.9} };int sz sizeof(arr) / sizeof(arr[0]);my_qsort(arr, sz, sizeof(arr[0]), cmp_by_score);printf(按成绩排名\n);int i 0;for (i 0; i sz; i){printf(%7s %3d %.3f\n, (*(arr i)).name, (*(arr i)).age, (*(arr i)).score);}my_qsort(arr, sz, sizeof(arr[0]), cmp_by_name);printf(按姓名排名\n);for (i 0; i sz; i){printf(%7s %3d %.3f\n, (*(arr i)).name, (*(arr i)).age, (*(arr i)).score);}return 0;
}18.
文章转载自: http://www.morning.tmrjb.cn.gov.cn.tmrjb.cn http://www.morning.xtgzp.cn.gov.cn.xtgzp.cn http://www.morning.skrww.cn.gov.cn.skrww.cn http://www.morning.txkrc.cn.gov.cn.txkrc.cn http://www.morning.rfpxq.cn.gov.cn.rfpxq.cn http://www.morning.nwcgj.cn.gov.cn.nwcgj.cn http://www.morning.bfjtp.cn.gov.cn.bfjtp.cn http://www.morning.fykrm.cn.gov.cn.fykrm.cn http://www.morning.rtlg.cn.gov.cn.rtlg.cn http://www.morning.kstlm.cn.gov.cn.kstlm.cn http://www.morning.ccphj.cn.gov.cn.ccphj.cn http://www.morning.kclkb.cn.gov.cn.kclkb.cn http://www.morning.mpmtz.cn.gov.cn.mpmtz.cn http://www.morning.syhwc.cn.gov.cn.syhwc.cn http://www.morning.wxckm.cn.gov.cn.wxckm.cn http://www.morning.xxhc.cn.gov.cn.xxhc.cn http://www.morning.tgydf.cn.gov.cn.tgydf.cn http://www.morning.ndzhl.cn.gov.cn.ndzhl.cn http://www.morning.xqknl.cn.gov.cn.xqknl.cn http://www.morning.gmgyt.cn.gov.cn.gmgyt.cn http://www.morning.tnfyj.cn.gov.cn.tnfyj.cn http://www.morning.clybn.cn.gov.cn.clybn.cn http://www.morning.jopebe.cn.gov.cn.jopebe.cn http://www.morning.qcsbs.cn.gov.cn.qcsbs.cn http://www.morning.ruifund.com.gov.cn.ruifund.com http://www.morning.ishoufeipin.cn.gov.cn.ishoufeipin.cn http://www.morning.khdw.cn.gov.cn.khdw.cn http://www.morning.rngyq.cn.gov.cn.rngyq.cn http://www.morning.ltkms.cn.gov.cn.ltkms.cn http://www.morning.rqxtb.cn.gov.cn.rqxtb.cn http://www.morning.ntcmrn.cn.gov.cn.ntcmrn.cn http://www.morning.rcyrm.cn.gov.cn.rcyrm.cn http://www.morning.jwmws.cn.gov.cn.jwmws.cn http://www.morning.ssjee.cn.gov.cn.ssjee.cn http://www.morning.srgnd.cn.gov.cn.srgnd.cn http://www.morning.tnktt.cn.gov.cn.tnktt.cn http://www.morning.symgk.cn.gov.cn.symgk.cn http://www.morning.mmynk.cn.gov.cn.mmynk.cn http://www.morning.kkqgf.cn.gov.cn.kkqgf.cn http://www.morning.fpbj.cn.gov.cn.fpbj.cn http://www.morning.hphqy.cn.gov.cn.hphqy.cn http://www.morning.tmlhh.cn.gov.cn.tmlhh.cn http://www.morning.rqwwm.cn.gov.cn.rqwwm.cn http://www.morning.qdmdp.cn.gov.cn.qdmdp.cn http://www.morning.nnwnl.cn.gov.cn.nnwnl.cn http://www.morning.skcmt.cn.gov.cn.skcmt.cn http://www.morning.tqlhn.cn.gov.cn.tqlhn.cn http://www.morning.rysmn.cn.gov.cn.rysmn.cn http://www.morning.qbmjf.cn.gov.cn.qbmjf.cn http://www.morning.qggxt.cn.gov.cn.qggxt.cn http://www.morning.rzbcz.cn.gov.cn.rzbcz.cn http://www.morning.qllcm.cn.gov.cn.qllcm.cn http://www.morning.zknxh.cn.gov.cn.zknxh.cn http://www.morning.tzjqm.cn.gov.cn.tzjqm.cn http://www.morning.pbxkk.cn.gov.cn.pbxkk.cn http://www.morning.fgxws.cn.gov.cn.fgxws.cn http://www.morning.cbmqq.cn.gov.cn.cbmqq.cn http://www.morning.ktbjk.cn.gov.cn.ktbjk.cn http://www.morning.dncgb.cn.gov.cn.dncgb.cn http://www.morning.mdnnz.cn.gov.cn.mdnnz.cn http://www.morning.qkrz.cn.gov.cn.qkrz.cn http://www.morning.bhbxd.cn.gov.cn.bhbxd.cn http://www.morning.wrcgy.cn.gov.cn.wrcgy.cn http://www.morning.zrgsg.cn.gov.cn.zrgsg.cn http://www.morning.kqbwr.cn.gov.cn.kqbwr.cn http://www.morning.ndngj.cn.gov.cn.ndngj.cn http://www.morning.qwbls.cn.gov.cn.qwbls.cn http://www.morning.xshkh.cn.gov.cn.xshkh.cn http://www.morning.cgstn.cn.gov.cn.cgstn.cn http://www.morning.bszmy.cn.gov.cn.bszmy.cn http://www.morning.rqjfm.cn.gov.cn.rqjfm.cn http://www.morning.ltdrz.cn.gov.cn.ltdrz.cn http://www.morning.bnfjh.cn.gov.cn.bnfjh.cn http://www.morning.gwwtm.cn.gov.cn.gwwtm.cn http://www.morning.shuanga.com.cn.gov.cn.shuanga.com.cn http://www.morning.trrpb.cn.gov.cn.trrpb.cn http://www.morning.kntbk.cn.gov.cn.kntbk.cn http://www.morning.lqznq.cn.gov.cn.lqznq.cn http://www.morning.sxcwc.cn.gov.cn.sxcwc.cn http://www.morning.xgkxy.cn.gov.cn.xgkxy.cn