String help

Posted on 2007-10-20
Last Modified: 2010-04-01
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 (, "Acme Manufacturing");
      //copy student's company into name
      strcpy (, name);
      cout << name << endl;  

      return 0;

Question by:gndcdosps
    LVL 53

    Accepted Solution

         strcpy (name,;

    The first parameter is the target, the second is the source.

    Author Comment

    Thanks again.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
    Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
    The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now