From 810fc1d9e5ce1951aead327167b91752dcd3beb1 Mon Sep 17 00:00:00 2001 From: Colby Weil <2ndtwo.2@gmail.com> Date: Mon, 15 Apr 2019 18:31:13 -0700 Subject: [PATCH] Fix buggy code --- buggy.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/buggy.c b/buggy.c index aae42b1..23bd083 100644 --- a/buggy.c +++ b/buggy.c @@ -13,25 +13,25 @@ struct dog { int age; - char name = [10]; + char name[10]; // Remove assignment operator }; void main() { - struct (dog) thing1: + struct dog thing1; // Remove parenthesis and change colon to semicolon struct dog thing2; - thing1.age = [5]; + thing1.age = 5; // Remove unnecessary brackets thing2.age = 13; - puts{"What is your dogs name? "}; - gets(thing1.names); + puts("What is your dogs name? "); // Change braces to parenthesis + gets(thing1.name); // Change 'names' to 'name' strcpy(thing2.name, "Buster"); - 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); + printf("Thing1 Name: %s\n",thing1.name ); // Specify thing number and change integer format tag to string + printf("Thing1 Age: %i\n",thing1.age); // Specify thing number and change colon to semicolon + printf("Thing2 Name: %s\n",thing2.name); // Add closing quotation mark + printf("Thing2 Age: %i\n",thing2.age); // Add colon and replace single quotation mark with double quotation mark } \ No newline at end of file