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
33 changes: 17 additions & 16 deletions buggy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
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