mirror of
https://github.com/Aexiar/c.git
synced 2024-10-22 14:05:45 +02:00
2024年10月9日 14:34
This commit is contained in:
parent
03bc13b952
commit
424ef8dd46
@ -555,11 +555,6 @@ int main()
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
/**
|
||||
* 求平方值
|
||||
* @param y
|
||||
* @return
|
||||
*/
|
||||
int SQ(int y) {
|
||||
return ((y) * (y));
|
||||
}
|
||||
@ -579,6 +574,18 @@ int main() {
|
||||
* 示例:使用带参宏定义计算平方值
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
#define SQ(y) ((y) * (y))
|
||||
|
||||
int main() {
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
printf("%d^2 = %d\n", i, SQ(i));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user