Hi.. I am learning C using Def c++. I struck at strcpy command. It giving error for a small exercise

      char string[20];
      strcpy("Hello", string); 
      printf("%s", string);

it giving error:
`strcpy' undeclared (first use this function)

Please help me that what can i do in dev c++ to get rid of this problem

Edited 5 Years Ago by Narue: Added cide tags

you also need to include string.h header file, like you did stdio.h header file.

>>what can i do in dev c++
First, stop using that old, obsolete compiler. Download free Code::Blocks with MinGW (they are free).

Edited 5 Years Ago by Ancient Dragon: n/a

As waltp said reread the syntax of strcpy(). It should be like this.


strcpy( /*character array which will hold the text after copying */ , /*string that is to be copied into another array*/ ) ;

Edited 5 Years Ago by Arbus: n/a

Stop downvoting people WaltP! You are so mean. He was just trying to help!
I could have told him that -- I wanted him to look it up

i think hidder files are missing
include the sdtlib.h file.
might work.

Do not post if you have no idea what you're talking about!

Thanks guys..
Thank your very much.....
specially for ancient dragon for solving my problem

This article has been dead for over six months. Start a new discussion instead.