Bài viết chương trình nhập xuất mảng con trỏ. Chương trình chạy đúng nhưng báo 2 warning: In function ‘NhapConTro’:|| Warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘int **’ / In function ‘XuatConTro’: Warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int *’…Giúp mình giải thích 2 cảnh báo này với!
Đây là code của mình:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
void NhapConTro (int n, int *pa[])
{
int i;
for (i = 0; i < n; i++)
{
printf ("PA[%d] = ", i);
scanf ("%d", pa + i);
}
}
void XuatConTro (int n, int *pa[])
{
int i;
for (i = 0; i < n; i++)
printf ("\n PA[%d] = %d", i, *(pa + i));
}
int main()
{
int n;
printf ("N = ");
scanf ("%d", &n);
int *pa[n];
NhapConTro (n, pa);
XuatConTro (n, pa);
getch ();
return 0;
}
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?