From c5d0eeef6d6a0d0bd774cf3012ee9fe61a0c47e6 Mon Sep 17 00:00:00 2001 From: mlgriffith <45371085+mlgriffith@users.noreply.github.com> Date: Mon, 26 Nov 2018 13:29:29 -0700 Subject: [PATCH] Update buggy.c MGriffith --- buggy.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/buggy.c b/buggy.c index aae42b1..2b428bd 100644 --- a/buggy.c +++ b/buggy.c @@ -10,28 +10,29 @@ */ -struct dog +struct dog // initiate struct { - int age; - char name = [10]; + int age; // declare variable for age + char name[10]; // declare variable and count for name }; -void main() +void main() // function main begins program execution { - struct (dog) thing1: - struct dog thing2; + struct dog thing1; // declare struct thing1 + struct dog thing2; // declare struct thing2 - thing1.age = [5]; - thing2.age = 13; + thing1.age = 5; // declare age thing1 + thing2.age = 13; // declare age thing2 - puts{"What is your dogs name? "}; - gets(thing1.names); + puts("What is your dogs name? "); // prompt user for input + gets(thing1.name); // display input - strcpy(thing2.name, "Buster"); + strcpy(thing2.name, "Buster"); // initiate strcpy - 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 + string, printf("Name: %s\n",thing1.name ); // display name of thing1 + printf("Age: %i\n",thing1.age); // display age of thing1 + printf("Thing2 Name: %s\n",thing2.name); // display name of thing2 + printf("Thing2 Age %i\n",thing2.age); // display age of thing2 + +} // end function main