• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

String help

Can someone tell me why this does not work.... I am trying to copy the student's company name into "name"
struct FUN {
      char description [21];
      char company [21];
      int month;
      int day;
};


int main() {
      char name [21];
      int answer;
      FUN student;
      FUN faculty;
      
      strcpy (student.company, "Acme Manufacturing");
      //copy student's company into name
      strcpy (student.company, name);
      cout << name << endl;  

      return 0;

}
0
gndcdosps
Asked:
gndcdosps
1 Solution
 
Infinity08Commented:
     strcpy (name, student.company);

The first parameter is the target, the second is the source.
0
 
gndcdospsAuthor Commented:
Thanks again.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now