Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <malloc.h>
- int *nhapmang(int &n)
- {
- int *a;
- printf("Nhap so luong phan tu trong mang: ");
- scanf("%d", &n);
- a = new int[n];
- for (int i = 0; i < n; i++)
- {
- printf("Nhap ptu %d: ", i + 1);
- scanf("%d", &a[i]);
- }
- return a;
- }
- void xuatmang(int *a, int n)
- {
- for (int i = 0; i < n; i++)
- {
- printf("Phan tu %d: %d\n", i + 1, a[i]);
- }
- }
- void main()
- {
- int *a = NULL;
- int n;
- a = nhapmang(n);
- xuatmang(a, n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement