Const değişkenin değiştirilmesini engellemeye yardımcı olur
--------------------------------------------------------------------------------
----------------------------------------------------------
#include
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
const int x = 5;
printf("yeryer %d\n\n",x);
x=2; ->>>>>>>>>>>>> BURADA HATA VERİR
printf("yeryer %d\n\n",x);
return 0;
}
--------------------------------------------------------------------------------
#include < QCoreApplication >
#include< stdio.h >
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
int x=5,y;
int *const ptr=& x;
printf("x in degeri %d idi \n\n",x);
*ptr=15;
ptr=&y; // ptr CONST degerdir adresi degistirilemez
return a.exec();
}
----------------------------------------------------------
#include < QCoreApplication >
#include< stdio.h >
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
int x=5,y;
const int *const ptr=& x;
printf("x in degeri %d idi \n\n",x);
*ptr=15; // ptr constur degeri degstirlemez
ptr=&y; // ptr CONST degerdir adresi degistirilemez
return a.exec();
}