c
1
总安装量
1
周安装量
#53604
全站排名
安装命令
npx skills add https://github.com/g1joshi/agent-skills --skill c
Agent 安装分布
mcpjam
1
claude-code
1
replit
1
junie
1
zencoder
1
Skill 文档
C
The foundational language for modern computing, operating systems, and embedded systems.
When to Use
- Operating Systems / Drivers
- Embedded Systems
- High-performance computing
- Legacy codebases
Quick Start
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Core Concepts
Pointers
Variables that store memory addresses.
int x = 10;
int *p = &x; // p holds address of x
printf("%d", *p); // Dereference p to get 10
Memory Management
Manual allocation and deallocation.
int *arr = (int*)malloc(10 * sizeof(int));
// use arr...
free(arr);
Structs
User-defined data types.
Best Practices
Do:
- Always initialized variables
- Check return values of
malloc - Guard against buffer overflows (use
snprintfoversprintf) - Use tools like Valgrind to check for leaks
Don’t:
- Return pointers to local variables (stack memory)
- Use
gets()(unsafe)