随笔分类 -  C\C++

摘要:for(auto &a:b) 等同于for(int i=0; i<sizeof(b); i++) 其中a是遍历b的每一个元素。 string t(n, '.'); 生成字符串t,每个元素都为'.'。 阅读全文
posted @ 2019-10-06 20:43 牧牛子 阅读(745) 评论(0) 推荐(1)
摘要:题目描述: 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取 来源:力扣(LeetCode)链接:https://leetcode-cn.com/ 阅读全文
posted @ 2019-10-06 11:48 牧牛子 阅读(299) 评论(0) 推荐(0)
摘要:设有以下程序段,则值为6的表达式是()。 struct st { int n; struct st *next;}; static struct st a[3]={5,&a[1],7,&a[2],9,0 } ,*p; p=&a[0];选项: p++->n++p->np->n++(*p).n++ 答案 阅读全文
posted @ 2019-09-14 20:08 牧牛子 阅读(170) 评论(0) 推荐(0)