Very simple questoin.

This is a discussion on Very simple questoin. within the C Programming forums, part of the General Programming Boards category; Hi all, Is there a easy way to copy an array to an array in a struct like following: struct ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    1

    Very simple questoin.

    Hi all,
    Is there a easy way to copy an array to an array in a struct like following:
    struct pailie
    {
    int ThisPailie[9];
    int ThisZhongJie[8];
    int ThisXuHao;
    };

    void main()
    {
    int m[9]={1,8,3,5,4,7,6,1,9};
    for (i=0;i<9;i++)
    pl.ThisPailie[i]=m[i];//COLOR=red]Is there a easy way to do this?[/COLOR]

    Thanks a lot.

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Isn't a loop easy? Else you could use a function like memcpy.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating very simple text editor using c
    By if13121 in forum C Programming
    Replies: 9
    Last Post: 10-19-2010, 06:26 PM
  2. Simple message encryption
    By Vicious in forum C++ Programming
    Replies: 10
    Last Post: 11-07-2004, 11:48 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  4. Simple simple program
    By Ryback in forum C++ Programming
    Replies: 10
    Last Post: 09-09-2004, 06:48 AM
  5. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21