In order to write in C you should move your code into a file called 'main.c' in your sketch folder. That way to C compiler will be used and not the C++ compiler. Keep the sketch file itself (.ino) empty.
You will have to include Arduino.h explicitly since that is something that Arduino does automatically for .ino files. If you don't include it, constants like "OUTPUT" and "HIGH" will not be defined. As you have been told before, it's not safe to use any Arduino features without first calling 'init()'. After you call init(), the delay() function should work. Also note that Arduino adds forward declarations in Arduino sketches. In C code you will have to declare functions before you call them.
#include <Arduino.h>
void delayAWhile(); // Forward Declaration (not supplied by Arduino on .c files)
int main () {
init(); // Initilize the Arduino libraries
// Set pins 2 through 12 to OUTPUT mode
for (byte ledPin = 2; ledPin <= 12; ledPin++)
pinMode(ledPin, OUTPUT);
while (true) {
// Light 2 through 12 in sequence
for (byte ledPin = 2; ledPin <= 12; ledPin++) {
digitalWrite(ledPin, HIGH);
delayAWhile();
digitalWrite(ledPin, LOW);
}
// Light 12 through 2 in sequence
for (byte ledPin = 12; ledPin >= 2; ledPin--) {
digitalWrite(ledPin, HIGH);
delayAWhile();
digitalWrite(ledPin, LOW);
}
}
return 0; // Never reached
}
//just a manual delay funct cuz the original one did not work at all
void delayAWhile() {
long long counter = 0;
while (counter < 100000UL) {
counter++;
}
}