by CodeChum Admin
We all know what man's best friend is. A dog! 🐶
Let's create one in our program using the pre-existing struct Dog provided.
Instructions:
#include <stdio.h>
struct Dog {
char breed[40];
};
void displayDog(struct Dog dog)
{
printf("\nDog breed: %s\n", dog.breed);
}
int main()
{
struct Dog dog;
printf("Input string: ");
scanf("%s", dog.breed);
displayDog(dog);
getchar();
}
Comments
Leave a comment