stdio.h
at the top of like every c program ever because it’s a library that needs to be included even just to print!e.g. int n = get_int()
but you only have to do that once! you don’t need to write the type before the name anymore when you’re using it in subsequent lines
btw you can initialize them without an assignment too! int n;
is a full, valid assignment.
and you’re allowed to declare more than one per line, like int x, y;
— note that you only need to say the type once, in that case.
void meow(int n)
void
in place of the data typeint main(void)
means that main
returns an int (?? somehow) and takes no argsmain
up there as the first function defined, so that people can more easily see what your program does at a high level. you can leave the full definition lower down if you just add a one line declaration (called a prototype) at the top too.void meow(int n);
and then you’ll still repeat that exact line (without the semicolon) when actually defining the function further downget_int
get_string
etc are special functions provided by the cs50 library, not standard parts of c