当前位置:网站首页>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.二分搜索
在有序的数组中找数字
程序:
三、排序初步
选择排序
如果数组本身没有排序,要用排序的算法排序
边栏推荐
- Build php7 private warehouse
- Which is the best one to make air conduction headphones? Inventory of the best air conduction headphones
- My deployment notes
- Technology sharing | interface testing value and system
- Shell script -- program conditional statements (conditional tests, if statements, case branch statements, echo usage, for loops, while loops)
- 组管理和权限管理
- 1、 PXE overview and installation
- Hdu-1097-a hard puzzle (fast power)
- How to calculate the size of structure, segment and Consortium (common body)
- 手把手教你三步完成测试监控系统搭建
猜你喜欢

Technology sharing | interface testing value and system

NAT和PAT的原理及配置

Shell script -- program conditional statements (conditional tests, if statements, case branch statements, echo usage, for loops, while loops)

DHCP principle and configuration

搭建PHP7私有仓库

SSH service configuration

shell脚本——正则表达式

技术分享 | 接口测试常用代理工具

shell脚本——“三剑客”之awk命令

DHCP原理与配置
随机推荐
Scratch command
技术分享 | 如何模拟真实使用场景?mock 技术来帮你
Technology sharing | how to do Assertion Verification in interface automated testing?
Software testing (concept)
LNMP搭建过程详解
KVM hot migration
Hdu-1159-commonsubsequence (LCS longest common subsequence)
raid磁盘阵列
Shell script - sort, uniq, TR, array sort, cut, Eval command configuration
Ubuntu18.04+centos7 configure redis master-slave [learning notes]
shell脚本——正则表达式
Shell script - "three swordsmen" awk command
What is the good brand of air conduction Bluetooth headset and the best brand recommendation of air conduction headset
shell脚本——编程条件语句(条件测试、if语句、case分支语句、echo用法、for循环、while循环)
What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying
MySQL主主
HDU-1159-CommonSubsequence(LCS最长公共子序列)
Clock tree analysis example
NAT和PAT的原理及配置
JSON notes








