当前位置:网站首页>0 basic C language (0)
0 basic C language (0)
2022-06-26 20:19:00 【the best b】
Today, I summoned up a lot of courage to open c The pit of language , because c I don't have a systematic book to read , I learned from the video , So there are some things I forgot that I might need to watch the video again , And some knowledge points may be forgotten and directly dropped , So c Don't like python Same every day , Maybe I have time to be more . In fact, watching the video again also consolidated my memory of knowledge points , I wrote this for notes , When you forget, you can look through . Another difficulty is , I now face a problem , sometimes python Things may be similar to c Remember mix , Because they have a lot in common , And the teachers are all men, and their memories are almost the same , I like to recall the sound scene and the content , If these two are really mixed , In fact, I don't know where to find this point . When writing this note, I will try my best to write out my confusing things .
c Language and python The essential difference is c Language has a prefix .
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}We can also find that the output section hello world from python A few short lines of have become such a large paragraph , In fact, the first three lines and the last two lines are each paragraph c Language code is necessary for runtime , The first line refers to the location of the file , The second line int It is not available at the present position , When we get to the function, we will explain why we should use int, After the braces is where we are going to program , hinder return 0 Is the end of programming position .
Next, let's look at the position we need to program each time, that is, the position inside the braces , from python Of print, Change it to printf Actually f It's formatting format Abbreviation ,
The most fatal thing is not these changes, but the latter ; Every time you finish programming, you should check it first. You should add ; Is there any place where , I dare to start compiling , Early because of this ; Wasted a lot of time , Usually after typing a piece of code , For the output , Obviously, it's the same as the one in the video, but it can't be compiled , After checking for a long time, it was found that such a small symbol was not written , It's very hard .
So every time I finish writing the code, I have to see if there are any places that should be added , So far I have learned , Add... After the loop and at the end of the loop ;. Because of this ; It is equivalent to telling the computer that this code is at the end , This is important for computers .
Look again printf() What's inside ,"" The contents are called strings printf It will output the contents intact , This one at the back \n It means to replace the output result with a new line .
For us, Chinese input method can be very deadly , Because the Chinese input method outputs symbols that are very similar to the English output , But the computer may be composed of several characters when understanding Chinese symbols , At the same time, it is very difficult to find errors in using Chinese characters , Therefore, when writing code, it is always in the state of English input .
When we are going to do an operation, we need to use &d, What we will enter is such a piece of code
printf("%d\n",23+43)We type in &d This indicates that there is an integer to be output at this position , After the comma is what we are going to output .
c Four budgets in language and python It's about the same +( Add )-( reduce )*( ride )/( except )%( Remainder )()( Brackets )
among % Represents the remainder after dividing two numbers .
边栏推荐
猜你喜欢

Project practice 4: user login and token access verification (reids+jwt)

Tiktok practice ~ homepage video ~ pull-down refresh

黑客用机器学习发动攻击的九种方法

IK word breaker

Tiktok practice ~ sharing module ~ short video download (save to photo album)

好物推荐:移动端开发安全工具

Three basic backup methods of mongodb

动态规划111

Database SQL statement writing

vue中缓存组件keep-alive
随机推荐
Installation and use of logstash
[MySQL series] collection of common working SQL (continuous update)
Analysis on development technology of NFT meta universe chain game system
C language file cursor fseek
Summary of several common UML diagrams
460million zongzi were sold in half a year. How big is the "imagination space" of time-honored brands?
Can I open an account online? Is it safe?
Arduino uno + DS1302 uses 31 byte static RAM to store data and print through serial port
swagger:如何生成漂亮的静态文档说明页
Unity - URP get camera stack
Boot指标监测
find_ path、find_ Library memo
Refresh the strong pointer assignment problem in the HP-UX system of Sanguan
回溯思路详解
Idea error: process terminated
C语言 文件光标 fseek
Muke 11. User authentication and authorization of microservices
抖音实战~分享模块~短视频下载(保存到相册)
Sword finger offer II 091 Paint the house
C primer plus learning notes - 3. Character IO (input / output)