#include<iostream.h>
#include<fstream.h>
main(){
int *a,n;
fstream f("matran.txt",ios::in);
if(!f.is_open()){
cout<<"Khong the mo file.";
return 0;
}
else{
f>>n;
a=new int [n*n];
}
cout<<sizeof(n)<<endl<<sizeof(a)<<endl<<n*n;
}
Cho em hỏi sau khi chạy sao nó lại ra sizeof(n)=4, sizeof(a)=4, n*n=9.
file matran.txt là:
3
1 2 3
4 5 6
7 8 9
Em mới học nên chưa rành lắm mong anh chị chỉ bảo.