C

- Files
.c.h- Formats as
- clang-format
- Lints
- Every rule that reads its code
- In
ur.toml [format.c]
Formatted
cart.c, as written#include <stddef.h>
/* What a cart costs. */
struct item { const char *name; int price; int quantity; };
int subtotal(const struct item *items, size_t count)
{
int sum=0;
for(size_t i=0;i<count;i++) sum+=items[i].price*items[i].quantity;
return sum;
}
ur format --style clang-format cart.c#include <stddef.h>
/* What a cart costs. */
struct item {
const char *name;
int price;
int quantity;
};
int subtotal(const struct item *items, size_t count) {
int sum = 0;
for (size_t i = 0; i < count; i++)
sum += items[i].price * items[i].quantity;
return sum;
}
Versions
Ur reads C as the profiles below name it. Name the versions a project targets in target; without it, Ur reads c-17.
| Profile | Dialect |
|---|---|
c-89 | GNU |
c-99 | GNU |
c-11 | GNU |
c-17 | GNU |
c-23 | GNU |