Thread: Does not work strcpy() function. -> incompatible implicit declaration of strcpy......

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    81

    Exclamation Does not work strcpy() function. -> incompatible implicit declaration of strcpy......

    I have a problem with the strcpy function. i think that we use it like this but there is a mistake...why?

    Is this wrong?
    Code:
    strcpy(new_buf, old_buf);
    if i want to put the old_buf="hi_my_old_man" into the new_buf which is empty in the beginning.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    int main(void)
    {
    	int choice;
    	char buf[40];
    		printf("Before strcpy: %s\n", buf);
    		strcpy(buf,"This is the end my friend");
    		printf("After: %s\n", buf);
    	return 0;
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    It's not empty, it has random crap in it. But your actual problem is that you haven't included string.h.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc warning: implicit declaration of function
    By anatoly in forum C Programming
    Replies: 4
    Last Post: 05-02-2010, 04:32 PM
  2. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  3. Replies: 15
    Last Post: 11-11-2007, 10:40 AM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM