12345678910111213141516171819202122232425
// temp struct #include <iostream> using namespace std; struct person { char firstName[40]; char lastName[40]; int age; long address; char street[40]; }; int main() { person firstPerson; firstPerson.firstName = "Tom"; firstPerson.lastName = "Smith"; firstPerson.age = 35; firstPerson.address = 42957; firstPerson.street = "Woodland"; return 0; }
strcpy(firstPerson.firstName, "Tom");
12
strcpy(firstPerson.firstName, "Tom", 39); // 1 less than buffer len, to ensure space fpr null