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
28 changes: 28 additions & 0 deletions lab12.1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <stdio.h>
#include <string.h>

struct dog
{
int age;
char name [10]; //removed =
};


void main()
{
struct dog thing1; //changed : to ;
struct dog thing2;

thing1.age = 5; //removed []
thing2.age = 13;

puts("What is your dogs name? "); //changed {} to ()
gets(thing1.name); //removed s at end of name(s)

strcpy(thing2.name, "Buster");

printf("Thing1 Name: %s\n",thing1.name ); //changed from %i to %s //smoothed sentence flow
printf("Thing1 Age: %i\n",thing1.age); //smoothed sentence flow
printf("Thing2 Name: %s\n",thing2.name); //added final " between \n and ,
printf("Thing2 Age %i\n",thing2.age); //changed ' to "
}