Commits

Ramakrishna Reddy Yekulla committed d2d3832

Added Exercise number 8

Comments (0)

Files changed (6)

+==================================
+License
+==================================

lcthw/README~

Empty file added.

lcthw/ex07

Binary file modified.

lcthw/ex08

Binary file added.
+#include <stdio.h>
+
+int main (int argc, char *argv[])
+{
+  int areas[] = {10,12,13,14,20};
+  char name[] = "zed";
+  char full_name[] = {
+    'Z', 'e', 'd',
+    ' ', 'A','.', ' ',
+    'S', 'h', 'a', 'w', '\0'
+  };
+
+  //WARNING: On some systems you may have to change the 
+  // %ld in this code to a %u since it will use unsigned ints
+
+  printf("The size of and int: %ld\n", sizeof(int));
+  printf("The size of areas (int[]): %ld\n", sizeof(areas));
+  printf("The number of ints in areas: %ld\n", sizeof(areas) / sizeof(int));
+  printf("The first area is %d, the 2nd %d.\n", areas[0], areas [1]);
+  printf("The size of a char: %ld\n", sizeof(char));
+  printf("The size of name (char[]): %ld\n", sizeof(name));
+  printf("The number of chars: %ld\n", sizeof(name) / sizeof(char));
+  printf("Tfe size of full_name (char[]): %ld\n", sizeof(full_name));
+  printf("The number of chars: %ld\n", sizeof(full_name)/ sizeof (char));
+  printf("name=\"%s\" and full_name=\"%s\"\n", name, full_name);
+  
+  return 0;
+
+}
+
+ 
+   
+#include <stdio.h>
+
+int main (int argc, char *argv[])
+{
+  int areas[] = {10,12,13,14,20};
+  char name[] = "zed";
+  char full_name[] = {
+    'Z', 'e', 'd',
+    ' ', 'A', ' ',
+    'S', 'h', 'a', 'w', '\0'
+  };
+
+  //WARNING: On some systems you may have to change the 
+  // %ld in this code to a %u since it will use unsigned ints
+
+  printf("The size of and int: %ld\n", sizeof(int));
+  printf("The size of areas (int[]): %ld\n", sizeof(areas));
+  printf("The number of ints in areas: %ld\n", sizeof(areas) / sizeof(int));
+  printf("The first area is %d, the 2nd %d.\n", areas[0], areas [1]);
+  printf("The size of a char: %ld\n", sizeof(char));
+  printf("The size of name (char[]): %ld\n", sizeof(name));
+  printf("The number of chars: %ld\n", sizeof(name) / sizeof(char));
+  printf("Tfe size of full_name (char[]): %ld\n", sizeof(full_name));
+  printf("The number of chars: %ld\n", sizeof(full_name)/ sizeof (char));
+  printf("name=\"%s\" and full_name=\"%s\"\n", name, full_name);
+  
+  return 0;
+
+}
+
+ 
+