Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions buggy.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,32 @@
3. create a new branch on git
4. git push changed buggy.c
5. create pull request with your name and changes you made
6. Send a screenshot of your pull request and put it in the dropbox

*/

struct dog
{
int age;
char name = [10];
char name [10]; /* Erased "=" */
};


void main()
{
struct (dog) thing1:
struct dog thing1; /* Got rid of parenthesis around "dog" and replaced the colon at the end with a semicolon */
struct dog thing2;

thing1.age = [5];
thing1.age = 5; /* Got rid of the brackets */
thing2.age = 13;

puts{"What is your dogs name? "};
gets(thing1.names);
puts("What is your dog's name? "); /* Replaced curly brackets with parenthesis and replaced "dogs" with "dog's" */
gets(thing1.name); /* Changed "thing1.names" to "thing1.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("Name: %s\n",thing1.name ); /* Replaced "%i" with "%s" */
printf("Age: %i\n",thing1.age); /* Replaced colon with a semicolon */
printf("Thing2 Name: %s\n",thing2.name); /* Added a quotation mark at the end of "Thing2 Name: %s\n" */
printf("Thing2 Age: %i\n",thing2.age); /* Attached a colon at the end of "Thing2 Age" and replaced the apostrophe with a quotation mark at the end of "%i\n" */
}