Hello-0.c David J. Malan Malan@harvard - Edu Says Hello To The World. Demonstrates Use of Printf.
Hello-0.c David J. Malan Malan@harvard - Edu Says Hello To The World. Demonstrates Use of Printf.
c
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
/**
* hello-0.c
*
* David J. Malan
* [email protected]
*
* Says hello to the world.
*
* Demonstrates use of printf.
*/
#include <stdio.h>
int main(void)
{
printf("hello, world\n");
}
lectures/1/m/src1m/hello-1.c
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
/**
* hello-1.c
*
* David J. Malan
* [email protected]
*
* Says hello to just David.
*
* Demonstrates use of CS50's library.
*/
#include <cs50.h>
#include <stdio.h>
int main(void)
{
string name = "David";
printf("hello, %s\n", name);
}
lectures/1/m/src1m/hello-2.c
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
/**
* hello-2.c
*
* David J. Malan
* [email protected]
*
* Says hello to whomever.
*
* Demonstrates use of CS50's library and standard input.
*/
#include <cs50.h>
#include <stdio.h>
int main(void)
{
printf("State your name: ");
string name = GetString();
printf("hello, %s\n", name);
}