-2
2次元配列のサイズを関数の引数として取って、配列を受け入れて何とかmain機能を追加します。 ビデオや投稿を見てみましたが、私の答えは得られませんでした。 いつものようにこの問題を助けてください。関数から2次元配列(int型)を受け取り、main関数に返す
int *accept(int a,int b)
{
int x[50][50];
for(int i=0;i<a;++i)
{
cout<<"Enter elements for "<<i+1<<" th row";
for(int j=0;j<b;++j)
{
cout<<"Enter "<<j+i<<" th element \n";
cin>>x[i][j];
}
}
return *x;
}
void main()
{
int arr[50][50],m,n;
cout<<"Enter the no of rows you want : ";
cin>>m;
cout<<"Enter the no of columns you want : ";
cin>>n;
arr[50][50]=accept(m,n); //how to copy?
は、少なくとも関数memcpyのは、何をするのか教えて使用することができます? –
この機能に関する情報は、こちらをご覧ください: http://www.cplusplus.com/reference/cstring/memcpy/ – Ash