C语言学习杂记

单片机的c语言 51单片机 C语言入门教程 51单片机 C语言学习杂记学习单片机实在不是件易事,一来要购买高价格的编程器,仿真器,二来要学习编程语言,还有众多种类的单片机选择真是件让人头痛的事。在众多单片机中 51架构的芯片风行很久,学习资料也相对很多,是初学的较好的选择之一。 51的编程语言常用的有二种,一种是汇编语言,一种是 C语言。汇编语言的机器代码生成效率很高但 阅读详情


extern、volatile、static关键字

  • extern 通常在头文件(a.h)定义,由此在其它文件(b.h引入#include “a.h”)可使用前者的变量、函数
  • 存储限定符volatile 是易变的、不稳定。声明如操作系统、硬件或者其它线程等因素修改了变量,而每次使用的时候必须从内存中取值,即从该变量的地址直接取值。编译器优化工作的一个假设,在多任务共享变量、中断与任务共享变量时,必须使用volatile,强制读取内存中的值。
  • static 存放在静态数据区、静态局部、静态全局。
    • 隐藏,静态全局 在本文件可用
    • 隔离
    • 持久,仅一次初始化为0
      一般程序把新产生的动态数据存放在堆区,函数内部的自动变量存放在栈区,前者是需要程序员手动申请和释放,后者由编译器自动分配和释放的。

常量指针、指针常量、指向常量的指针常量

  • 常量指针(常指针):const int *p; 本质上是指针,值不可改变,而可以通过改变指向(更改值)
    #include <stdio.h>
    int main() {
        int num1 = 1, num2 = 2;
    	// 常量指针
    	const int *p = &num1;
    	printf("%d\r\n", *p);	// 1
    	// 改变指向
    	p = &num2;
    	printf("%d\r\n", *p);	// 2
    
    	num2 = 3;
    	printf("%d\r\n", *p);	// 3
    	return 0;
    }
    
  • 指针常量:int * const p; 本质上是常量,值可以改变,而指向不可改变
    #include <stdio.h>
    int main() {
        int num1 = 1;
    	// 指针常量
    	int * const p = &num1;
    	printf("%d\r\n", *p);	// 1
    	// 改变值
    	num1 = 2;
    	printf("%d\r\n", *p);	// 2
    	
    	*p = 3;
    	printf("%d\r\n", num1);	// 3
    	return 0;
    }
    
  • 指向常量 的 指针常量,const int * const p,指向和值都不可改变
    #include <stdio.h>
    int main() {
        int num1 = 1;
    	// 指向常量 的 指针常量
    	const int * const p = &num1;
    	printf("%d\r\n", *p);	// 1
    	
    	num1 = 2;
    	printf("%d\r\n", *p);	// 2
    	return 0;
    }
    
  • const int const *p
    #include <stdio.h>
    int main() {
        int num1 = 1;
    	
    	const int const *p = &num1;
    	printf("%d\r\n", *p);	// 1
    	
    	num1 = 2;
    	printf("%d\r\n", *p);	// 2
    	return 0;
    }
    

字符串char[]拼接及十六进制转十进制

#include <stdio.h>  
#include <string.h>
int main()  
{  
    char str1[] = "09";
    char str2[] = "A1";     
    int num = 0;
    // "09a1"
    strcat(str1,str2);
    // 2465
    sscanf(str1,"%x",&num);
    
    printf("%d\r\n", num);  
    return 0;     
}  

注 atoi()只能针对十进制字符串转整型

#include <stdio.h>
#include <stdlib.h>
int main()
{
	char str[] = "11";
	int num = atoi(str);
	printf("%d\r\n", num);
	return  0;
}

保留高位0

#include <stdio.h>
int main()
{
	int num1 = 0x01;
	// 这里低位保留为02,而非2
	int num2 = 0x02;
	int num3 = (num1 << 8) | num2;
	// 102 258
	printf("%x %i", num3, num3);
	return 0;
}

串口传输float浮点型转换

.h

typedef union _Float_u{
	struct 
	{
		unsigned char char_bit_0;
		unsigned char char_bit_1;
		unsigned char char_bit_2;
		unsigned char char_bit_3;
	}Float_s;
	
	int integerVal;
	float floatVal;
	uint8_t u16_to_u8[4];
	uint16_t u8_to_u16[2];
}Float_u;

.c

Float_u float_u;
float_u.floatVal = 3.14159;
uint8 buf[4];
buf[0] = float_u.char_bit_0;
buf[1] = float_u.char_bit_1;
buf[2] = float_u.char_bit_2;
buf[3] = float_u.char_bit_3;
// or
buf[0] = float_u.u16_to_u8[0];
buf[1] = float_u.u16_to_u8[1];
buf[2] = float_u.u16_to_u8[2];
buf[3] = float_u.u16_to_u8[3];
// revert
float_u.u16_to_u8[0] = buf[0];
float_u.u16_to_u8[1] = buf[1];
float_u.u16_to_u8[2] = buf[2];
float_u.u16_to_u8[3] = buf[3];
printf("%f", float_u.floatVal);
Seedance 2.5本地部署指南:AI生图与视频生成的完整实践 最近在AI生成内容领域,本地部署方案越来越受到开发者关注。特别是Seedance 2.5的发布,让很多原本依赖云端服务的用户开始转向本地化解决方案。本文将从实际使用角度出发,完整介绍Seedance 2.5的本地部署流程、功能特性对比以及实际应用技巧。 1. Seedance 2.5核心特性解析 1.1 什么是Seedance 2.5 Seedance 2.5是一款开源的AI生图和视频生成工具,支持在本地环境运行,无需联网即可实现高质量的图像和视频生成。相比之前的2.0版本,2.5在生成质量、运行效率和功能 阅读详情

相关推荐

Playwright自动化测试实战:攻克日历时间控件三大策略与Java实现

在Web自动化测试领域,元素定位与交互模拟是核心技术基础,其原理在于通过程序精确识别并操作页面中的DOM元素,以模拟真实用户行为。这项技术的核心价值在于提升测试效率、确保交互逻辑的覆盖度与可靠性,广泛应用于电商、金融、OA等系统的功能验证。日历时间控件作为典型的复杂交互组件,常涉及动态弹出层、多级导航与状态同步,是自动化测试中的常见难点。本文聚焦于使用Playwright工具,针对此类控件深入剖析了三种核心解决策略:从最高效的直接赋值、到全面模拟用户交互的主流方法,再到利用组件特性的混合定位方案,并结合Ja

weixin_28835551的博客 313

51单片机C语言学习杂记

2006-04-28 20:39:40 51单片机C语言学习杂记 0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" height=30 src="http://www.xie-gang.com/Imag

mybirdsky的专栏 949

PX4无人机实战:手把手教你用MAVROS实现Offboard模式(附避坑指南)

本文提供了一份详尽的PX4无人机Offboard模式实战指南,重点解析了如何通过MAVROS实现从仿真到实机的控制。内容涵盖硬件连接、串口权限设置、MAVROS配置、核心代码编写以及实机操作全流程,并附有详细的避坑指南和故障排查手册,帮助开发者快速掌握ROS与PX4飞控的集成开发。

weixin_29172201的博客 273

C语言学习DAY1 杂记

数据类型与基本语句 基本数据类型 整型int 整数,在目前绝大多数机器上占4个字节。TC环境中是2个字节 单精度实型float 单精度浮点数,一般是4个字节长 双精度实型double 双精度浮点数,一般是8个字节长 字符型char 字符,一般是1个字节长 用来表示256个ASCII字符,或者0~255的整数 转义字符: 一些特殊字符(无法从键盘输入或者另有它用)用转义字符表示 \n : 换行 ...

weixin_44339311的博客 207

11-4 AEB 算法原理及系统组成

本专题旨在探讨如何利用仿真软件开发自动紧急制动系统AEB,主要通过整理开发流程,实现从需求到验证的全流程掌握,为后续开发提供支持;同时,研究了如何在汽车自动驾驶仿真工具中开发自己的算法,并解决了从ISO、E-CNAP、GB/T以及交通法规等提炼出功能需求的问题,以快速实现原型模型的开发。本专题重点讲解了AEB的工作原理、系统/软件架构和需求、算法模型及实现、CCRs/CCRb/CCRm建模与仿真、VRU-AEB-B/P/M建模与仿真,同时还提供了测试用例,期待将AEB算法成功地产品化。

AIgraphX 8572

onnx入门教程(一):解决模型部署中的难题

直接使用 PyTorch 模型的话,我们修改几行代码就能实现模型输入的动态化。但在模型部署中,我们要花数倍的时间来设法解决这一问题。现在,让我们顺着解决问题的思路,体验一下模型部署的困难,并学习使用自定义算子的方式,解决超分辨率模型的动态化问题。刚刚的报错是因为 PyTorch 模型在导出到 ONNX 模型时,模型的输入参数的类型必须全部是 torch.Tensor。而实际上我们传入的第二个参数" 3 "是一个整形变量。这不符合 PyTorch 转 ONNX 的规定。我们必须要修改一下原来的模型的输入。

图像学习之旅 1131

C语言学习 杂记(一)

C语言学习 杂记(一) 说明:仅仅是个人学习时遇到的问题总结学习记录,如有错误,烦请指出,定当虚心接受!!!请大家多多指点。 (1)三目运算 int main() { int num; printf("输入一个数字:"); scanf("%d", &num); (num % 2 == 0) ? printf("偶数") : printf("奇数"); } (2)随机函数 int main() { int a; srand((unsigned)time(NULL));//重新播种,如果不

weixin_45893089的博客 263

风光储互补微电网在偏远地区的应用实践:从建模到仿真全解析

本文深入解析了风光储互补微电网在偏远地区的应用实践,从系统设计到仿真建模全流程。通过Simulink等工具进行动态仿真,验证了系统在多种工况下的可靠性,并结合实际案例展示了其显著的经济和环保效益。文章为从业者提供了从技术路径到实施优化的全面指导。

weixin_29047545的博客 275

c语言学习中的杂记

1,gets()后边不用getchar(),gets()后边不会自动加结束符,%s自动加结束符。 2。求n的阶乘的位数 #include #include #include int main() {     int n,i;     double sum;     scanf("%d",&n);     for(i=2,sum=0.0;i     sum=sum+log

扬帆起航 345

海思芯片YOLOv8模型部署完整指南:从RPN硬化到8bit量化精度优化

本文详细介绍了在海思芯片平台部署YOLOv8目标检测模型的完整方案,重点解决8bit量化精度损失问题。通过分析海思RPN硬化层的性能优势(1.9ms推理时间),对比不同量化策略(16bit仅损失0.6AP,8bit损失5.2AP),并深入定位到strides计算层是量化误差的主要来源。关键突破在于采用混合精度策略(敏感层16bit,其余8bit),使8bit量化AP回升4.1%,同时保持3.4ms的推理速度和60%的低NPU占用率。文章还提供了量化参数调整、校准数据集优化等进阶技巧,为边缘计算应用提供了性能

FJN110的博客 744

YOLO26涨点改进 | NeurIPS2025最佳论文!注意力改进篇| 引入Gated Attention门控注意力模块、太牛了!直接拯救了大模型的发展,助力目标检测、图像分割、图像分类有效涨点

本文提出了一种基于门控注意力机制(GatedAttention)的YOLO26模型改进方法。该方法在标准softmax注意力机制中引入头部特定的sigmoid门控,通过增强注意力机制使模型更聚焦于关键信息。实验表明,该模块能显著提升模型性能,特别是在复杂背景和密集目标场景中,同时减少无关区域关注并提高检测精度。门控机制引入的非线性和稀疏性不仅提升了推理效率,还改善了训练稳定性,使模型能采用更大学习率并增强扩展性。此外,该方法有效缓解了"注意力下沉"现象,增强了模型对长距离目标的感知能力。

Ai缝合怪、助力小伙伴高效发论文 668

c语言学习的的杂记

1,int的1后边9个0,longlong是1后边18个0; 2,以10为底的对数是log10(x),以e为敌的是log(x) 3,sort的复杂度为n*log(n) 4,%s与puts的区别是%s遇到空格结束,puts是遇到换行结束,puts是输出函数,gets是输入函数 5,辗转相除法,用来求最大公约数,如下代码; int f(int a int b) {   c=a%b;  i

扬帆起航 469

从入门到精通:3D视觉与SLAM实战全流程 mastery 教程

本文系统介绍了3D视觉与SLAM技术的应用前景、核心技术和实战路径。3D视觉通过RGB-D相机、激光雷达等传感器获取环境三维信息,SLAM技术实现自主定位与地图构建,二者结合广泛应用于自动驾驶、机器人导航等领域。文章详细拆解了点云处理、视觉里程计、回环检测等关键技术,并提供了ORB-SLAM2算法复现、语义SLAM开发的实战教程,涵盖硬件选型、环境配置到代码实现全流程。最后规划了从入门到专家的学习路径,推荐了相关书籍、开源项目和数据集资源,为读者掌握这一前沿技术提供了完整指南。

m0_71589036的博客 149

C 语言学习(杂记)

一  若在A.c里面写了一个函数,想在D.c里面调用,则采用的方式是: 1 在A.c里面写函数, int function(int a) { } 同时也对其进行EXPORT_SYMBOL(function)声明,而且也应该包含该头文件,以便编译器检查定义和声明的一致性。 2 然后再在A.h头文件里面声明:     int function(int);      可以加上

追求梦想 840

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

关于c语言学习的小总结(主要是指针)杂记

经过3个月的学习,差不多已经学完了c,下面是我的一些杂记,主要是指针方面,希望能够给 小白一些参考; <stdio.h> 带着就对了 <math.h> 好像涉及数学的都要带 例如sqrt <string.h>一类 str, #difine 提前对某个值赋值; scanf % & 确定整数/小数/等等,然后赋值 结尾是printf(“xxx %d/f/…”,xxx); int 假设 一般是int x,x,x…; 数字 float 单精度(带小数且较小较精确)

四夕的博客 437

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

C语言学习杂记1|学习软件选择

Windows 11 桌面环境下的学习软件,以及C语言学习文件的正确创建

liegu0317的博客 1022

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

C语言学习——数据类型杂记

(1)掌握b[10]数组中的值不同的原因。 int b[10]; printf("%d,%d,%d,%d",b,b+1,&b,&b+1); (2)变量:既能读又能写的内存对象   三要素:名称、大小、作用域 变量本质:连续内存空间的别名(相当于门牌号),变量可以有多个别名 (3)数据类型本质:固定大小内存块别名 (4)修改内存的方法(直接和间接) int main() { i

万里居士 331

c语言 什么时候加 &符号 printf,C语言学习杂记(3)

8种机械键盘轴体对比本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?C语言的字符串不是基本类型,而是字符序列,可以把字符串看成一个以’ ’结尾的字符数组。’ ’其实是一种特殊字符,其数值为0。一、示例先看一个示例:#include #include #define STIP "127.0.0.1"int main(void){char name[40];int length;int si...

weixin_28698129的博客 1709

嵌入式C语言学习——杂记

1.变量:能读能写,肯定在内存中。

weixin_45386924的博客 164

C语言中%u输出十六进制的数,C语言学习杂记(2)—C的数据

计算机的计算和存储都是数据。在C语言里,数据同样是基础,学好数据的知识是必须的。先看一个最简单的例子#include int main(void){int weight;float cost;float value;printf("please input your weight.\n");scanf("%d", &weight);printf("please input your sin...

weixin_34515649的博客 1564

c语言格式化输入输出字符串,C语言学习杂记(3)—字符串格式化输入输出

C语言的字符串不是基本类型,而是字符序列,可以把字符串看成一个以'\0'结尾的字符数组。'\0'其实是一种特殊字符,其数值为0。一、示例先看一个示例:#include #include #define STIP "127.0.0.1"int main(void){char name[40];int length;int size_of;int age;printf("please input yo...

weixin_34910679的博客 411

【杂记】c语言基础知识

c语言相关的基础知识杂记,随便记一记—————— 需要注意的是,如果输入的字符串长度没有超过 n–1,那么系统会将最后输入的换行符 '\n' 保存进来,保存的位置是紧跟输入的字符,然后剩余的空间都用 '\0' 填充。所以此时输出该字符串时 printf 中就不需要加换行符 '\n' 了,因为字符串中已经有了。

南京大学软件工程硕士在读 1316

51单片机c语言学习笔记,51单片机学习笔记.docx

PAGE6 / NUMPAGES1351单片机 手册TOC \o "1-3" \h \z \u HYPERLINK \l "_Toc431221573" 51单片机 手册 PAGEREF _Toc431221573 \h 1HYPERLINK \l "_Toc431221574" 开发板 PAGEREF _Toc431221574 \h 1HYPERLINK \l "_Toc431221575"...

weixin_35509069的博客 324

C语言编程杂记

1.整型变量            在C语言中,使用整型变量可以使用八进制,十进制,十六进制数。其中十进制数没有任何前缀,八进制数需要前缀0, 如010, 0762,,等,十六进制数需要0x前缀,如0xFF, 0x98等。 2.指针 指针常量,在C语言中,指针常量只有一个NULL(空地址),因为程序事先是无法知道某个特定变量在内存中会存储到哪个位置,故指针常量表示为数值字面值没有用。 字符

Crazy Tortoise 874

杂记:学习C语言时的一些学习记录

本篇为杂记若有需要的内容使用ctrl+f进行关键词查找

方林 211

【1024打卡】C++字符串的输出((c语言风格)

c++字符串输出(c语言风格) 文章目录c++字符串输出(c语言风格)杂记代码 杂记 今天程序设计竞赛白给了,果然还是太弱了,y总带带我TAT ┭┮﹏┭┮1024快乐 代码 c语言学习 #include<iostream> #include<cstdio> using namespace std; int main() { printf("%s\n","Hello,1024"); puts("I'm coming!"); char str[] = "

子美(m0_51242575)的博客 2193
上一篇: 计算机网络 知识结构导图
下一篇: STM32的学习使用记录
Link2Points
博客等级 码龄7年 152粉丝 80原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值