2025-08-18 20:01:21

This commit is contained in:
swangnice
2025-08-18 20:01:21 +08:00
parent 8a920994bf
commit 7c31f72eea
254 changed files with 29201 additions and 3566 deletions

View File

@@ -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);
```

View File

@@ -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>
```

View 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')"
```

View File

@@ -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.

View 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.