当前位置:网站首页>Half search, character array definition, character array uses D11
Half search, character array definition, character array uses D11
2022-06-26 13:53:00 【Apple ADC】
One . Use half search to learn debugging
Find the premise in half : The data must be in order .
In the length of len Array of arr in , Find keywords key, Successfully returned subscript , Failure to return -1
Two . Character array definition
1. hold drr[10] The elements in are represented in turn
#include<stdio.h>
int main()
{
int arr[]={1,2,3,4};
char brr[10];
short crr[10];
double drr[10]={12.3,34.5,56.7,67.9};
for(int i=0;i<sizeof(drr)/sizeof(drr[0]);i++)
{
printf("%f",drr[]);
}
return 0;
} 2.0 In the form of :0,0.0,false,NULL,'\0'
character : single quote '' One character included , for example 'a','1','0'
character string : Use double quotes "" A string included , from 0 One or more characters , for example " ","1234","adf ab"
There must be a hidden '\0' End of expression '\0' Is the end of the string
Is it a string : Is there any " " perhaps Is there any '\0'
Report errors : Ironing : Local variable uninitialized
int main()
{
char arr[5]={'a','b','c','d','e'};// It's not a string
char brr[10]={'a','b','c','d','e'};// Uninitialized section displays '\0' Is string
char crr[]={'a','b','c','d','e'};// It's not a string
char drr[10];// It's not a string
// Character array specific definitions
char err[]="abcd";
char frr[4]="abcd";// Report errors , There's also a hidden one '\0'
char grr[10]="abcd";
char *hrr="abcd";// String constant contents cannot be modified
}3、 ... and . The character array uses
#include<stdio.h>
int main()
{
char str1[10]="abcde";// The overall assignment of the whole group has only one initialization opportunity
char str2[10]="xyz";
char str3[10];
str2=str3; // Report errors , You cannot assign values as a whole
str1+=str2;// Report errors
int i;
for(i=0;i!='\0';i++)// Using strings '\0' The closing mark
{
str2[i]=str1[i];
}
str2[i]='\0';// Add end tag '\0'
printf("str1=%s\n str2=%s\n",str1,str2);
return 0;
} 边栏推荐
- Some conclusions about Nan
- MySQL explanation (I)
- Nexys A7开发板资源使用技巧
- 虫子 STL string 下 练习题
- Cloudcompare - Poisson reconstruction
- 嵌入式virlog代码运行流程
- 33、使用RGBD相机进行目标检测和深度信息输出
- Teacher Li Hang's new book "machine learning methods" is on the market! Purchase link attached
- A primary multithreaded server model
- 计算两点之间的距离(二维、三维)
猜你喜欢

Ring queue PHP

MySQL explanation (II)

Detailed sorting of HW blue team traceability process

古瑞瓦特沖刺港交所上市:創下“多個第一”,獲IDG資本9億元投資

MySQL explanation (I)

创建一个自己的跨域代理服务器

Basic type of typescript

Stack, LIFO

ICML 2022 | limo: a new method for rapid generation of targeted molecules

Thinking caused by the error < note: candidate expectations 1 argument, 0 provided >
随机推荐
KITTI Detection dataset whose format is letf_ top_ right_ bottom to JDE normalied xc_ yc_ w_ h
Here document interaction free and expect automatic interaction
7-2 picking peanuts
Create your own cross domain proxy server
Es common grammar I
Bug memory management
【系统分析师之路】第十五章 复盘数据库系统(数据库案例分析)
网络远程访问的方式使用树莓派
【Proteus仿真】Arduino UNO按键启停 + PWM 调速控制直流电机转速
输入文本自动生成图像,太好玩了!
It is better and safer to choose which securities company to open an account for flush stock
Gee - Global Human Settlements grid data 1975-1990-2000-2014
Stream常用操作以及原理探索
MongoDB系列之适用场景和不适用场景
微信小程序注册指引
7-1 n queen problem
MySQL explanation (I)
KITTI Tracking dataset whose format is letf_ top_ right_ bottom to JDE normalied xc_ yc_ w_ h
Mediapipe gestures (hands)
Ring queue PHP