[ create a new paste ] login | about

Link: http://codepad.org/da6upi6A    [ raw code | output | fork ]

C++, pasted on Jan 9:
1
2
3
4
5
6
7
8
int main()
{
    int size = 10;
    int a[size]; // ошибка, т.к. size не константа
    int * b = new int[size]; // нет ошибки, память выделяется динамически

    return 0;
}


Output:
1
2
3
In function 'int main()':
Line 4: error: ISO C++ forbids variable-size array 'a'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: