Working with array in the programming language C++

Print Friendly, PDF & Email

Trong C++, bạn có thể khai báo mảng một chiều như sau:

int amount[];
int* amount;

Đối với hai trường hợp này cần khởi tạo, chúng ta có thể làm như sau:

int n = G->numberofVertices(); // Lấy số đỉnh của đồ thị G
amount = new int[n];

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.