Bu derste dinamik bellek yönetiminin nasıl yapıldığını göreceksiniz.
Kursa 27.99 TL'ye kayıt olmak için TIKLAYINIZ.
Dinamik Bellek Yönetimi Giriş
#include <iostream>
using namespace std;
int main()
{
int boyut=4;
int *adres = new int[boyut];
int *adres2;
*adres = 10;
*(adres+1) = 20;
*(adres+2) = 30;
*(adres+3) = 40;
adres2=adres;
for(int i=0;i<4;i++){
cout<<*(adres+i)<<endl;
}
delete [] adres;
adres=nullptr;
delete [] adres2;
adres2=nullptr;
/* for(int i=0;i<4;i++){
cout<<*(adres2+i)<<endl;
}*/
//cout<<*(adres+1)<<endl;
/* for(int i=0;i<3;i++){
cout<<*(adres+i)<<endl;
}*/
return 0;
}