First remove the semicolon from the declaration of main
. You should use a semicolon at the end of a prototype of a function and not in the function itself. (If you don't know about prototypes don't worry you'll learn later about them). Secondly in your for loop you use i without declaring it first. So intead of
for (i = 0 ; s[i] != '\0' ; ++i)
use
for (int i = 0 ; s[i] != '\0' ; ++i)
I think that will fix your problems. As a note though keep in mind that the compiler tells you exactly where your problem is. So when I ran your code the first time it gave the following error:
init.c:9:1: error: expected identifier or '('
{
^
1 error generated.
make: *** [init] Error 1
So on line 9 there is a curly brace that it thinks shouldn't be there. If search a line above you will see the semicolon. Hope I helped and if so mark the answer as correct! Have a nice one!