View Single Post
  #1  
Old 13-10-2008, 10:11 PM
BSIT07-01's Avatar
BSIT07-01 BSIT07-01 is offline
Addicted to Computer


 
Join Date: Sep 2007
Location: ------------
Age: 34
Posts: 1,309
Contact Number: ---------------
Program / Discipline: BSIT
Class Roll Number: 07-01
BSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant future
Default Copy elements of Two arrays to another ONE in C++

Code:
#include <iostream>
using namespace std;

void main()
{
    int n=10;
    char myarray1[5]={'1','2','3','4','5'};
    char myarray2[5]={'6','7','8','9','0'};
    char myarray3[10];

    for(int i=0;i<=n;i++)
    {
        if(i<=5)
        {
            myarray3[i]=myarray1[i];
        }
        else
        {
            myarray3[i]=myarray2[i-5];
        }
    }

    cout<<myarray3[9]; // shows that myarray3 has Got values from other arrays on it's 9 index 

}

Reply With Quote