2025-08-18 20:01:21
This commit is contained in:
@@ -2,4 +2,54 @@
|
||||
title = 'C'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
+++
|
||||
+++
|
||||
|
||||
<!-- 笔试题有的时候不给正常输入,只给plain text -->
|
||||
## Format Specifier
|
||||
|
||||
Common specifiers:
|
||||
```
|
||||
%d int
|
||||
%u unsigned int
|
||||
%c char
|
||||
%s string (char s[])
|
||||
%p void*
|
||||
%ld long
|
||||
%lld long long (64bits)
|
||||
%f float/double
|
||||
%lf float/double(usually used in scanf)
|
||||
```
|
||||
We can extend the format specifiers:
|
||||
``` C
|
||||
printf("%5d", 33); // width " 33"
|
||||
printf("%.2f", 3.14159); // precision "3.14"
|
||||
printf("%8.2f", 3.14159);// " 3.14"
|
||||
printf("%-5d", 33); //Alignment "33 "
|
||||
```
|
||||
|
||||
## IO
|
||||
Read or print via terminal:
|
||||
|
||||
``` C
|
||||
int x;
|
||||
scanf("%d", &x);
|
||||
printf("%d", x);
|
||||
```
|
||||
|
||||
|
||||
## Type Conversion
|
||||
String to int, float....
|
||||
``` c
|
||||
int i = atoi("123");
|
||||
double d = atof("3.14");
|
||||
|
||||
long l = strtol("123", NULL, 10); // safer, auto detec errors
|
||||
double d2 = strtod("3.14", NULL);
|
||||
```
|
||||
|
||||
Numbers to string:
|
||||
``` c
|
||||
int i = 123;
|
||||
char buf[20];
|
||||
sprintf(buf, "%d", i);
|
||||
```
|
||||
|
||||
@@ -32,12 +32,12 @@ git remote add private https://<git_domain>/<username>/project-private.git
|
||||
|
||||
|
||||
## Branch
|
||||
List all branches:
|
||||
List all branches, the branch where you are currently working is marked with an asterisk (*):
|
||||
``` bash
|
||||
git branch -a
|
||||
```
|
||||
|
||||
Move to a specific branch, the branch where you are currently working is marked with an asterisk (*):
|
||||
Move to a specific branch:
|
||||
``` bash
|
||||
git checkout <branch_name>
|
||||
```
|
||||
|
||||
11
content/en/notes/coding/cheat_sheet/git/index.md
Normal file
11
content/en/notes/coding/cheat_sheet/git/index.md
Normal file
@@ -0,0 +1,11 @@
|
||||
+++
|
||||
title = 'Git'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## Commit
|
||||
1. Add date and time in commit messages:
|
||||
``` bash
|
||||
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')"
|
||||
```
|
||||
@@ -7,5 +7,7 @@ weight = 100
|
||||
|
||||
Here are some insights from my experiences with MCUs. Additionally, you can find my personal MCU benchmark site [here](https://mcubenchmark.swangnice.cn).
|
||||
|
||||
Additionally, I know several excellent books about CPU architecture and plan to share a series of notes based on them.
|
||||
|
||||
|
||||
|
||||
|
||||
14
content/en/notes/mcu/cpu_architecture_notes/_index.md
Normal file
14
content/en/notes/mcu/cpu_architecture_notes/_index.md
Normal file
@@ -0,0 +1,14 @@
|
||||
+++
|
||||
title = "Notes on CPU Architecture"
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
series = ["CPU Architecture Notes"]
|
||||
series_order = 1
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
I hope to share several books about CPU architecture here, and this is a book list:
|
||||
1. Computer Organization and Design RISC-V Edition. _David A. Patterson & John L. Hennessy_
|
||||
2. Computer Architecture: A Quantitative Approach. _John L. Hennessy & David A. Patterson_
|
||||
|
||||
Additionally, I plan to create CPU demonstrations using Verilog/SystemVerilog.
|
||||
Reference in New Issue
Block a user