C语言第三课

orangepi香橙派用户名及密码修改和VNC远程登陆 1、修改 /etc/passwd用户信息文件 vim /etc/passwd #admin❌503:501::/home/admin:/bin/bash #把用户名admin改成rest #test❌503:501::/home/test:/bin/bash 2、修改 /etc/shadow用户密码文件 vim /etc/shadow #admin:Dnakfw28zf38w:8764:0:168:7::: #由于密码加密方式存放,只修改用户名即可(密码不变) #test:Dnakfw28zf38w:876 阅读详情

1.补充第二课

(1)~   二进制按位取反//一个二进制数,首位0表示该数是正数,首位是1表示该数是负数。

(如:0101取反为1010)

源码,反码,补码的概念

源码:范围:-127 ~ +127,最高位是符号位,0表示正数,1表示负数  字长8位

[+0]原 = 0000 0000
[-0]原 = 1000 0000

反码:源码的范围:-127 ~ +127

负数--符号位(即第一位)不变,其他为取反      正数--跟源码一样

补码:源码的范围:-128 ~ +127

正数--跟源码相同  负数--x补=x反+1

如果 [-0]补 = [-0]反 +1 = 1 1111111 + 1 = 1 00000000,这个结果是用来表示 -128,而8位字长的0000 0000是表示[+0]的,产生冲突。其中反码+1,结果只保留低位的7位数字位,溢出的会置位溢出,而结果只保留低七位

**只要是整数,内存中存储的都是二进制的补码

解释代码

int main()
{
    int a = 0;//4个字节,32个比特位
    int b = ~a;//b是有符号的整型
    //000000000000000000000000
    //~二进制取反:111111111111111111111111
    printf("%d\n", b);//打印b的源码
    //111111111111111111111111(b的补码)
    //111111111111111111111110(先算b的反码 即补码-1)
    //100000000000000000000001=-1(b的结果)
    return 0;
}

(2)++    后置++:自增(先使用,后++)     前置++(与后置相反)

int a=10;
    int b = ++a;
    printf("a=%d,b=%d\n",a, b);//a=11,b=11

int a=10;
    int b = a++;
    printf("a=%d,b=%d\n",a, b);//a=11,b=10

--同理

2.其他操作符

(1)关系操作符

(2)逻辑操作符

假 :0       真 :非0

int a = 5;
    int b = 3;
    int c = a && b;
    printf("c=%d\n", c);//c=1(a,b都为真-->真,a,b其中有一个为假-->假)

||(a和b中有一个为真-->真)

(3)条件操作符(三目操作符)

exp1?exp2:exp3

(4)常见下标引用,函数调用

[]:下标引用操作符 arr[4]//数组

():函数调用操作符

(5)常用关键字

break  continue  case  char  const  default  do  enum  extern goto register signed unsigned

static struct switch tyepdef  union  void  volatile  

unsigned  无符号

unsigned int

typedef--类型定义--类型重定义  如typedef unsingned int=typedef u_int

(就是给unsingned int重新起一个名u_int)

static修饰局部变量,改变局部变量的生命周期

修饰全局变量,改变了变量的作用域,让静态的全局变量只能在自己所在的源文件内部使用

修饰函数,改变了函数的链接属性。(一般的函数都具有外部链接属性,就是可以随便被extern声明然后修改。而static把函数的外部连接属性改为内部链接属性,既无法被随便声明)

void test()
{
    static int a = 1;
    a++;
    printf("a=%d\n", a);//2,3,4,5,6
}
int main()
{
    int i = 0;
    while (i < 5)
    {
        test();
        i++;
    }
    return 0;

extern:申明外部符号

#define1.定义标识符常量 #define MAX 100

2.定义宏--带参数

#define MAX(X,Y) (X>Y?X:Y)
int main()
{
    int a = 10;
    int b = 20;
    int max = MAX(a, b);
    printf("max=%d\n", max);//有了define这两行就等于下面两行了
    max = MAX(a, b);
    printf("max=%d\n", max);
    return 0;
}

2.指针

(1)内存

如何产生地址?32位-->32跟地址线/数据线-->当作电线,里面有正电和负电(1和0)-->二进制

-->可以产生2^32位地址   符号&+变量

int a = 10;//4个字节
    int*p = &a;//用来存放地址的变量--指针变量
    //printf("%p\n", p);
    *p=20;//*解引用操作符/间接访问操作符,使p找到a并改为20
    printf("a=%d\n",a);

注意:指针大小在32位平台是4个字节,64位平台是8个字节,不管是谁的地址,统统看是多少位

char ch = 'w';
    char* pc = &ch;//p+操作符关键字首字母
    printf("%d\n", sizeof(pc));//可以用这个来验证

在上方Debug处点击配置管理器可以调32位和64位加以验证

(2)结构体:C语言怎么描述复杂对象

以书为例:描述一本书需要书名+价格等

struct Book
{
    char name[20];//名字
    short price;//价格
};//不能漏掉!
int main()
{
    //利用结构体类型创建一个该类型的结构体变量
    struct Book b1 = { "C语言",55 };
        printf("书名:%s\n", b1.name);//.找到b1里面的name
    printf("价格:%d元\n", b1.price);
    b1.price = 15;
    printf("修改后的价格:%d\n", b1.price);

return 0;}

用指针写(.版👇)

struct Book b1 = { "C语言",55 };
    struct Book* pb = &b1;
    printf("%s\n", (*pb). name);//结构体变量.成员
    printf("%d\n", (*pb).price);

(->版👇)

struct Book b1 = { "C语言",55 };
    struct Book* pb = &b1;

printf("%s\n", pb->name);//结构体指针->成员
    printf("%d\n", pb->price);

ps怎么改上述程序的书名

struct Book b1 = { "C语言",55 };
    strcpy(b1.name, "C++");//strcpy-string copy-字符串函数-库函数-string.h
    printf("%s\n", b1.name);
    return 0;
}

2023.03.27更新大麦网PC端抢购软件和使用教程 近期发现大麦网页端抢购页面悄然发生变化,之前可以在页面选择票价、档次,并且点击按钮进行购票,现在不行了,新的页面如下图所示。已经安全没有了点击按钮,因此,但是并不代表不能像以前之前那样。 阅读详情

相关推荐

八大排序算法——(万字图文详解)

本篇博客将对“直接插入排序”、“希尔排序”、“直接选择排序”、“堆排序”、“冒泡排序”、“快速排序”、“归并排序”、“计数排序”进行详细的解析(算法逻辑、具体实现过程、时间复杂度、稳定性),并附以图片帮助大家更好地理解算法逻辑以及实现每个排序的参考代码。

Forward♞的博客 8074

C语言学习第三课

学习笔记3

u012229318的博客 377

告别TI官网迷路!手把手教你用C2000Ware为TMS320F28027搭建Proteus仿真工程模板

本文详细指导如何使用C2000Ware为TMS320F28027搭建Proteus仿真工程模板,帮助DSP开发者快速上手。从资源获取、工程目录设计到关键文件配置,再到CCS与Proteus的联调技巧,全面解析仿真工程搭建的每个步骤,特别适合初学者和工程师参考。

weixin_42715608的博客 472

c语言学习第三课—简单介绍数组与操作符

操作符与数组讲解

qq_61422622的博客 329

Simulink封装与库的建立

第二栏设置标签,第三栏是对应变量名,即是第一张图中的常量名。1.先将输入与常量模块相连接并生成子系统。按照如图所示添加修改,最后的效果如下图。封装子系统搭建测试环境。

lensyu1994的博客 1738

ITIL-IT运维管理-概述

ITIL-IT运维管理-概述 概述 IT服务管理(ITSM)是一套帮助企业对IT系统的规划、研发、实施和运营进行有效管理的方法,是一套方法论。ITSM起源于ITIL(IT Infrastructure Library,IT基础架构标准库),ITIL是CCTA(英国国家电脑局)于1980年开发的一套IT服务管理标准库。它把英国在IT管理方面的方法归纳起来,变成规范,为企业的IT部门提供一套从计划、研发、实施到运维的标准方法。 中文名 IT服务管理 外文名 ITService Management 专家

syjhct的博客 4万+

C语言学习———第三课

程序设计的结构: 顺序结构 程序按照代码的编写方向,从左到右,从上到下执行所有的代码 选择结构 程序根据选择结构关键词进行选择执行代码内容。eg: if(istrue){ }else{ }; switch(char a){ case "1": break; default: break; } 循环结构 程序根据循环结构关键词进行选择执行代码内容。eg:...

qq_35719857的博客 220

Codex入门10-Goal自主任务(进阶必学:设定目标就不管了,AI自己干活到完成)

/goal 是Codex CLI最强大的进阶功能——设定一个目标,AI就会制定计划、分步执行、自我测试、持续迭代,即使你关掉终端也会继续。本文详解/goal的工作原理、配置启用方法、常用命令(pause/resume/status/clear),以及如何写出高质量的目标描述让AI高效自主完成任务。

yueyeguzhuo的专栏 453

鹏哥C语言第三课

printf("闰年的判断,能被4整除且不能被100整除是闰年,能被400整除是闰年,可多次输入\n");printf("如果用%%c要强制跳过前面的空格,需要在%%c前面加一个空格\n");printf("if语句,输入年龄,大于等于18输出成年,反之未成年\n");printf("if语句,要求输入一个整数,先判断正负,再判断奇偶性\n");printf("输入的年份为%d是闰年\n", year);printf("if语句,要求输入一个整数,判断0,正数,负数\n");

weixin_75111693的博客 890

【通信协议】GATT 与 BLE HID 工作原理详解

详细介绍BLE HID 跟GATT工作原理与两者的交互关系

以实战经验介绍行业知识 842

ArduPilot简介

一,什么是ArduPilot? ArduPilot是一个可信的,多用途的,开源的自动驾驶系统。该系统支持了非常多的交通工具类型,包括多旋翼无人机,传统直升机,固定翼飞行器,船,潜艇,巡逻车等。源码由大型开发者社区的专家和爱好者共同开发和维护。也欢迎更多的开发者加入源码的迭代演进,最好的“打开”方式就是加入开发者团队论坛。该论坛对所有人开放,在这里可以深入感受到开发者们对ArduPilot的热爱。 论坛链接:ArduPilot Discourse 开发者指南:Welcome to the ArduPil

从0到1,突破自己 5450

初学C语言(第三课)

时隔几日,我又回来了,几天没更新,肯定有人说我懒,我可没有(偶尔还是偷懒耍了耍会儿,都是正事儿还是不会忘的喽),接着回来给大家分享笔记,嘿嘿。

xiaoyu_0603的博客 713

【嵌入式 – GD32开发实战指南(ARM版本)】第1部分 基础篇 - 第1章 开发环境搭建

开发环境: MDK:Keil 5.30 MCU:GD32F207IK 1.1 GD32F207I-EVAL开发板简介 笔者使用的开发板是兆易创新设计的GD32F207I-EVAL开发板。 GD32F207I-EVAL开发板使用 GD32F207IK作为主控制器,主频120MHz、集成3MB Flash、256KB SRAM、通用定时器*10、Adv. TM*2、Basic TM*2、系统时钟*1、看门狗*2、RTC*1、USART*4、UART*4、I2C*3、SPI*3、I2S*1、SDIO*1、CAN

不问归期的博客 9985

C语言基础课程 第三课 ADB(Android Debug Bridge)的使用

 C语言基础课程 第三课 ADB(Android Debug Bridge)的使用    由于前面已经发布过Linux的博客了 基础班将Linux基础命令就不单独发表博客了,本节课主要就是利用adb连接手机进行一个Linux基本命令的复习。而且熟悉手机的底层运作,不用界面操作照样也能安装软件  卸载软件与pc传数据    目  录1       将android设备通过USB连接到P

尹成的技术博客 3500

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

C语言第三课:系统编程与项目实战

/ 带参数的宏// 带参数的宏 # define MAX(a , b)((a) >(b)?(a) :(b)) # define SQUARE(x)((x) *(x)) // 调试宏 # ifdef DEBUG # define LOG(fmt , . . .) printf("[DEBUG] " fmt , ## __VA_ARGS__) # else # define LOG(. . .) # endif// 带参数的宏 # define MAX(a , b)((a) >(b)?

ldq520的博客 420

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

c语言第三课

/%s代表字符串占位符,%d代表整型占位符,%c代表单个字符的占位符,%f代表浮点型的占位符。//+=:a+=1代表a=a+1,-=:b-=1代表b=b-1!a=1:a=0 a+b=c吗,等于的话a=1,不等于的话a=0。switch(a)//判断语句,判断a是不是等于99,100,88。printf("一个int占%d\n",sizeof(int));printf("a等于100\n");printf("a等于100\n");printf("d的值=%d\n",d);

2401_85440178的博客 342

深度学习工具包 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")

C语言初学第三课

一、注释 二、数据类型

ye_jinling的博客 374

C语言入门——第三课

1.顺序、循环、选择语句 2.C语言帮助文档 3.字符转大小写有数字 4.逗号表达式 5.函数 6.编译连接过程

m0_54231818的博客 215

C函数改了参数,外面的值为什么有时变、有时不变?

整数、指针、数组形参都可以值传递,为什么修改结果不同?追踪复制的值和实际访问的对象,再解释数组地址为什么还需要长度。

doting__的博客 187
上一篇: C语言第二课(笔记)
下一篇: C语言第四课:分支和循环
cx努力编程中
博客等级 码龄4年 264粉丝 95原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值