You should start with the hello world program.
This covers IO and pointers in one shot.
// This is the classic "hello World" program written in C
// Send to the console the text "Hello World"
// include standard library functions in order to use printf
#include <stidio.h>
#include <stdlib.h>
// main does not return error codes in this application, so return nothing (void)
// there are no command line parameters passed so we have an empty parameter list ( )
void main()
{
// Send the text "Hello World" to the console
printf("Hello World");
// end the program
}
Things to think about this code,
The string "Hello World" is a constant the actual string is NOT passed to printf however.
printf is defined as a variable arguement function as such
int printf(const char *, ...);
Elipse is C mean that this function can accept a variable number of arguements.
Notice const char *.
char * <-- refers to a pointer to a string
const says it must be a constant (IE not a variable).
This means printf accepts as it's first parameter a pointer to a string constant.
So you are passing a pointer to a string to the printf function, and since you are not passing any more than just that, it sends the output of that string to a special file called, STDOUT also known as the console. You can perform interactive IO with the console, but I don't recomend it since this is messy and complicated especially if you wish to obtain binary data (like that used in FF7).
A lot goes on in a simple program like hello world. I suggest reading your textbook and writting a few programs to handle simple things. If you are new to Computer Science, I suggest reading as much as possible about the principles of programming before writting code. A good suggestion (technically it is a commandment as you might get a poorer grade if you don't do this) ALWAYS comment your code as to specifically what you are doing. The comments are not for you, thus you should never assume whoever is reading them knows what you are talking about. My comments aren't always the best but hopefully they'll give you a clue as to the things you should say and do in them.
Cyb