i am confused.plz help me.

how to creat a dinamic ARRAY of size (n*n) where n is specifeid by user
wirit a function.
# include<iostream>
# include<conio.h>
using namespace std;

int main(){

int x;
int y;
int **arrayy=new int*[8];
for(int i=0;i<8;i++)
arrayy[i]=new int [8];
You should really read this:
http://www.cplusplus.com/forum/articles/17108/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <cstddef> // for std::size_t
#include <iostream> // for std::cin, std::cout

int main()
{
    std::size_t n=0;

    std::cout << "Specify n: ";
    std::cin >> n;

    int **mda = new int*[n];

    for (std::size_t i=0; i < n; ++i)
        mda[i] = new int[n];

    // we can use mda[x][y] now

    // now we must clean up
    for (std::size_t i=0; i < n; ++i)
        delete[] mda[i];

    delete[] mda;
}


what does the mean?
std::size_t n=0;

i am beggner so plz write it simplr for me,
(std::size_t i=0; i < n; ++i)..plz define it for me.tnx

std::size_t is just like unsigned long int.
std::size_t can store a positive integer.

You should use std::size_t to help other programmers know that you are using the variable for sizes and lengths.

what does the mean?
std::size_t n=0;


It's equivalent to:

unsigned long int n=0;
Last edited on
one thng brother,how i write above program in function?
one thng brother,how i write above program in function?

How does the bird fly, brother?
How does the boat float, brother?
How does the sky
Spin 'round so high
And bestow upon us life's water,
My brother?
okt nx..i will try.if i fail,thwn will tell you
Topic archived. No new replies allowed.