Sephinroth

struct_example

Oct 11th, 2023
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. struct p {
  4.     char first_name[20];
  5.     char second_name[20];
  6. };
  7.  
  8. int main() {
  9.     struct p person_1 = {"John", "Smith"};
  10.     struct p person_2;
  11.     scanf("%s", person_2.first_name);
  12.     scanf("%s", person_2.second_name);
  13.     printf("%s %s\n", person_1.first_name, person_1.second_name);
  14.     printf("%s %s\n", person_2.first_name, person_2.second_name);
  15.     return 0;
  16. }
  17.  
Add Comment
Please, Sign In to add comment