# C

> C programming with memory management, pointers, structs, and system-level development. Use for .c files. Use when this capability is needed.

- Skill: `tomevault-io/c-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/c-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/c-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/c-2

---


# 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

```c
#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}
```

## Core Concepts

### Pointers

Variables that store memory addresses.

```c
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.

```c
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 `snprintf` over `sprintf`)
- Use tools like Valgrind to check for leaks

**Don't**:

- Return pointers to local variables (stack memory)
- Use `gets()` (unsafe)

## References

- [C Reference](https://en.cppreference.com/w/c)

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/g1joshi) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-14 -->

