/* Hello, World! program example in C CSE 374, Winter 2014 */ /* Start with any necessary include statements to bring in definitions from libraries or any user-defined functions. */ #include /* main is a reserved keyword. The main function is where execution starts. The signature is similar to other functions: returnType functionName ( paramList ) { functionBody } where paramList can be empty or dataType varName pairs and pairs are separated by commas. In main, you have argc, the number (or count) of arguments, and argv, the values of the arguments. argv is a pointer to an array of pointers to the argument values. */ int main(int argc, char** argv) { /* The body of the function is contained within a matched pair of { } C does not care whether the { is on the same line with the function signature or not, and white space is up to the developer or any imposed stylistic standards (like Java). In python, however, indentation means something. */ /* Here we have a basic printf statement with one string as an argument to the function printf. \n is a newline character, while \t is a tab. */ printf("\n\n\tHello, World!\n\n"); /* The following is a return statement. This is similar to an exit statement or command in a shell script. This value will be returned to the operating system when the program is done. Usually a zero value means everything was fine, and other numbers can be used at the developer's discretion to signal various problems during execution. */ return 0; }