~laumann/C

f1172a51137b7b1ec8e87939d80c6473af2ebdda — Thomas Bracht Laumann Jespersen 9 years ago 1b9f5d8
A few indentation problems
3 files changed, 23 insertions(+), 25 deletions(-)

M begin/ageif.c
M begin/str.c
M begin/struct.c
M begin/ageif.c => begin/ageif.c +12 -14
@@ 2,20 2,18 @@

int main()
{
  int age;
  int BARRIER = 100;
	int age;
	int BARRIER = 100;

  printf("Please enter your age: ");
  scanf("%d", &age);
	printf("Please enter your age: ");
	scanf("%d", &age);

  if (age < BARRIER) {
    printf("You are pretty young!\n");
  }
  else if (age == BARRIER) {
    printf("You are old\n");
  }
  else {
    printf("You are REALLY old!\n");
  }
  return 0;
	if (age < BARRIER) {
		printf("You are pretty young!\n");
	} else if (age == BARRIER) {
		printf("You are old\n");
	} else {
		printf("You are REALLY old!\n");
	}
	return 0;
}

M begin/str.c => begin/str.c +10 -10
@@ 5,19 5,19 @@
int
main(int argc, char **argv)
{
  char string[BUFSIZ];
  char *p;
	char string[BUFSIZ];
	char *p;

  printf("Please enter a long string (max length: %d): ", sizeof(string));
	printf("Please enter a long string (max length: %d): ", sizeof(string));

  if (fgets(string, sizeof(string), stdin) != NULL) {
    printf("Thank you. You entered >%s<\n",string);
	if (fgets(string, sizeof(string), stdin) != NULL) {
		printf("Thank you. You entered >%s<\n",string);

    if ((p = strchr(string, '\n')) != NULL)
      *p = '\0';
		if ((p = strchr(string, '\n')) != NULL)
			*p = '\0';
    
    printf("And now our string is >%s<\n", string);
  }
		printf("And now our string is >%s<\n", string);
	}

  exit(0);
	exit(0);
}

M begin/struct.c => begin/struct.c +1 -1
@@ 44,5 44,5 @@ struct_pointer_f(x *zp)
void
print_function(const char *fname, const char *name, int value)
{
	printf("%16s: %8s = %d\n", fname, name, value);
	printf("%-16s: %8s = %d\n", fname, name, value);
}