Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First commit

  • Loading branch information...
commit 766dfdda1485904ef940e7331485fbe14547f2f1 0 parents
@zachwill authored
1  .gitignore
@@ -0,0 +1 @@
+*.out
21 04_01_exercise.c
@@ -0,0 +1,21 @@
+// Excercise 4.1
+// =============
+//
+// Write a program to print your name, social security number,
+// and date of birth.
+
+#include <stdio.h>
+
+char *name, *social, *birth_month;
+
+int main() {
+ name = "Zach";
+ social = "LOL-YEAH-RIGHT";
+ birth_month = "March";
+
+ printf("Name: %s\n", name);
+ printf("Social: %s\n", social);
+ printf("Birth Date: %s\n", birth_month);
+
+ return 0;
+}
23 04_03_area_exercise.c
@@ -0,0 +1,23 @@
+// Excercise 4.3
+// =============
+//
+// Write a program to compute the area of a given rectangle.
+
+#include <stdio.h>
+
+int height, width, area;
+
+int main(int argc, const char *argv[]) {
+ if (argc == 3) {
+ height = atoi(argv[1]);
+ width = atoi(argv[2]);
+ } else {
+ height = 3;
+ width = 5;
+ }
+
+ area = height * width;
+ printf("Area is: %d\n", area);
+
+ return 0;
+}
4 README.md
@@ -0,0 +1,4 @@
+Practical C
+===========
+
+Solutions to exercises for the [Practical C book](http://www.amazon.com/dp/1565923065/).
Please sign in to comment.
Something went wrong with that request. Please try again.