当前位置:网站首页>MOOC翁恺C语言第七周:数组运算:1.数组运算2.搜索3.排序初步
MOOC翁恺C语言第七周:数组运算:1.数组运算2.搜索3.排序初步
2022-07-28 05:28:00 【W.934】
一、数组运算
1.数组运算
1.数组运算
在一组给定的数据中,如何找出某个数据是否存在。
2.集成初始化时的定位
![]()
3.数组的大小
sizeof给出整个数组所占据的内容的大小,单位是字节。
数组元素的个数:sizeof(a)/sizeof(a[0])
sizeof(a[0])给出数组中单个元素的大小,sizeof(a)给出数组大小;相除就得到了数组的单元个数。
好处:若修改数组中初始的数据,不需要修改遍历的代码。
4.数组的赋值
遍历数组:
数组作为函数参数时,往往必须在用另一个参数来传入数组的大小。
2.数组例子:素数
prime[count++]==i;
二、搜索
1.线性搜索
搜索:
2.二分搜索
在有序的数组中找数字
程序:
三、排序初步
选择排序
如果数组本身没有排序,要用排序的算法排序
边栏推荐
猜你喜欢

NFS shared storage service

Custom components -- styles

SSH service configuration

Technology sharing | send requests using postman

Applet custom components - data, methods, and properties

Technology sharing | detailed explanation of actual combat interface test request methods get, post

Which is the best one to make air conduction headphones? Inventory of the best air conduction headphones

Firewall - iptables firewall (four tables and five links, firewall configuration method, detailed explanation of matching rules)

QGraphicsView提升为QChartView

MySQL master master
随机推荐
Difference between process and thread
Firewall - iptables firewall (four tables and five links, firewall configuration method, detailed explanation of matching rules)
技术分享 | 服务端接口自动化测试, Requests 库的这些功能你了解吗?
小tips
PKU-2739-Sum of Consecutive Prime Numbers(筛素数法打表)
NFS shared storage service
Ubuntu18.04搭建redis集群【学习笔记】
QT uses MSVC compiler to output Chinese garbled code
Wechat applet custom compilation mode
防火墙——iptables防火墙(四表五链、防火墙配置方法、匹配规则详解)
PKU-2524-Ubiquitous Religions(并查集模板)
MySQL installation and use
Custom components -- styles
Applet creation component
单元测试框架Jest搭配TypeScript的安装与配置
技术分享 | 如何模拟真实使用场景?mock 技术来帮你
Applet custom components - data, methods, and properties
技术分享 | 接口测试常用代理工具
JSON notes
Hdu-5783 divide the sequence (greedy water question)








