From 27c4230be02c2a5a644836c9fd6d92731d529f48 Mon Sep 17 00:00:00 2001 From: msskadsen Date: Wed, 12 Dec 2018 18:20:45 -0600 Subject: [PATCH] helped out --- buggy.c | 61 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/buggy.c b/buggy.c index aae42b1..91ddf22 100644 --- a/buggy.c +++ b/buggy.c @@ -1,37 +1,46 @@ +// +// main.c +// lab12 +// +// Created by Matthew Skadsen on 12/12/18. +// Copyright © 2018 Matthew Skadsen. All rights reserved. +// #include #include /* Assignment: -1. fix bugs in the code -2. add comments -3. create a new branch on git -4. git push changed buggy.c -5. create pull request with your name and changes you made - -*/ - -struct dog + 1. fix bugs in the code + 2. add comments + 3. create a new branch on git + 4. git push changed buggy.c + 5. create pull request with your name and changes you made + + */ + +struct dog //creating a struct for dogs { - int age; - char name = [10]; + int age; //declaring age variable + char name [10]; //declaring name array }; void main() { - struct (dog) thing1: - struct dog thing2; - - thing1.age = [5]; - thing2.age = 13; - - puts{"What is your dogs name? "}; - gets(thing1.names); - - strcpy(thing2.name, "Buster"); + struct dog thing1; //declaring first dog thing1 + struct dog thing2; //declaring second dog thing2 + + thing1.age = 5; //initializing thing1's age as 5 + thing2.age = 13; //initializing thing2's age as 13 + + puts("What is your dog's name? "); //using puts to ask for dog name + gets(thing1.name); //using gets to assign entered data for thing1's name + + strcpy(thing2.name, "Buster"); //using strcpy to assign thing2's name + + printf("Name: %s\n",thing1.name ); //printing thing1's name + printf("Age: %i\n",thing1.age); //printing thing1's age + printf("Thing2 Name: %s\n",thing2.name); //printing thing2's name + printf("Thing2 Age %i\n",thing2.age); //printing thing2's age + +} - printf("Name: %i\n",thing1.name ); - printf("Age: %i\n",thing1.age): - printf("Thing2 Name: %s\n,thing2.name); - printf("Thing2 Age %i\n',thing2.age); -} \ No newline at end of file