Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C indentation styles from wikipedia "Indent Style"
// From https://en.wikipedia.org/wiki/Indent_style
// K & R
while (x == y) {
something();
somethingelse();
}
// 1TBS
if (x < 0) {
puts("Negative");
} else {
nonnegative(x);
}
// Stroustup
if (x < 0) {
puts("Negative");
negative(x);
}
else {
puts("Non-negative");
nonnegative(x);
}
// Allman
while (x == y)
{
something();
somethingelse();
}
// GNU
while (x == y)
{
something();
somethingelse();
}
// Whitesmiths
while (x == y)
{
something();
somethingelse();
}
// Horstmann
while (x == y)
{ something();
somethingelse();
}
// Pico
while (x == y)
{ something();
somethingelse(); }
// Ratliff
while (x == y) {
something();
somethingelse();
}
// LISP
while (x == y) {
something();
somethingelse(); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment