1 00:00:00,000 --> 00:00:00,450 2 00:00:00,450 --> 00:00:03,280 >> SPEAKER 1: Let's take a look at the simplest of programs and see. 3 00:00:03,280 --> 00:00:08,300 I've already opened gedit and saved my file as hello zero.c. 4 00:00:08,300 --> 00:00:10,160 Let's now recreate it. 5 00:00:10,160 --> 00:00:17,750 Include standardio.h int main void open curly brace and, in advance, 6 00:00:17,750 --> 00:00:23,120 closed curly brace, then an indentation, printf, quote, unquote 7 00:00:23,120 --> 00:00:30,220 "hello, world" backslash n close close parenthesis semicolon. 8 00:00:30,220 --> 00:00:30,640 >> All right. 9 00:00:30,640 --> 00:00:32,229 So what are the salient characteristics of 10 00:00:32,229 --> 00:00:33,195 this particular program? 11 00:00:33,195 --> 00:00:34,980 Well, let's start with line one. 12 00:00:34,980 --> 00:00:40,690 In line one, we have a sharp include statement followed by standard io.h. 13 00:00:40,690 --> 00:00:44,870 Well, sharp include simply tells the compiler go include the contents of 14 00:00:44,870 --> 00:00:47,700 the following file right there in my own file. 15 00:00:47,700 --> 00:00:48,830 What file is that? 16 00:00:48,830 --> 00:00:50,940 Well, it's a file called standard io.h. 17 00:00:50,940 --> 00:00:54,430 And inside of that file are so-called declarations of functions that we 18 00:00:54,430 --> 00:00:55,560 might find of interest. 19 00:00:55,560 --> 00:01:00,460 In this case, printf happens to be the function that is declared in that 20 00:01:00,460 --> 00:01:01,730 separate file. 21 00:01:01,730 --> 00:01:04,250 >> Now in line three, we have some additional, new 22 00:01:04,250 --> 00:01:06,990 syntax, int, main, void. 23 00:01:06,990 --> 00:01:11,060 Well, int refers to the so-called return type of main, 24 00:01:11,060 --> 00:01:12,740 what value it returns. 25 00:01:12,740 --> 00:01:15,420 For the most part, we can turn a blind eye to this for now. 26 00:01:15,420 --> 00:01:20,080 But take on faith that main is by default and implicitly going to 27 00:01:20,080 --> 00:01:22,650 return, so to speak, a value of zero. 28 00:01:22,650 --> 00:01:24,530 But more on that another time. 29 00:01:24,530 --> 00:01:27,130 >> Meanwhile, the name of this function is, indeed, main. 30 00:01:27,130 --> 00:01:30,140 And that's the default name for any program written in C. And then 31 00:01:30,140 --> 00:01:34,060 finally, inside of the parentheses here, we have void, which simply says 32 00:01:34,060 --> 00:01:37,210 that this program takes no command line arguments. 33 00:01:37,210 --> 00:01:40,170 But let's take a closer look at those another day, as well. 34 00:01:40,170 --> 00:01:43,140 >> Finally, the most interesting line, of course, is line five. 35 00:01:43,140 --> 00:01:46,230 And that's where we define the essence of this program, which is to print to 36 00:01:46,230 --> 00:01:49,570 the screen, that is, display hello world. 37 00:01:49,570 --> 00:01:51,050 Printf is a function. 38 00:01:51,050 --> 00:01:54,430 And again, that function is declared in that other file called standard 39 00:01:54,430 --> 00:01:57,670 io.h that someone else implemented long ago. 40 00:01:57,670 --> 00:02:01,530 And printf appears to take one argument, so to speak. 41 00:02:01,530 --> 00:02:06,540 Because there is a quoted string, a sequence of characters, in between 42 00:02:06,540 --> 00:02:10,280 that pair of parentheses, that implies that printf, indeed, does take one 43 00:02:10,280 --> 00:02:13,360 argument, and that argument is going to influence its behavior. 44 00:02:13,360 --> 00:02:16,650 >> In this case, it's going to instruct printf exactly what to 45 00:02:16,650 --> 00:02:18,110 print on the screen. 46 00:02:18,110 --> 00:02:21,380 The semicolon, meanwhile, at the end of this line simply says, that's it 47 00:02:21,380 --> 00:02:22,110 for this statement. 48 00:02:22,110 --> 00:02:23,030 I'm all done. 49 00:02:23,030 --> 00:02:26,280 The fact that on line six we have the closing curly brace means, indeed, 50 00:02:26,280 --> 00:02:27,690 this program is complete. 51 00:02:27,690 --> 00:02:29,580 And there we have it, hello world. 52 00:02:29,580 --> 00:02:31,138