ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is pointer and does java support pointer? Give reasons.

user-image
تم إضافة السؤال من قبل Maryam Albalushi
تاريخ النشر: 2015/12/03
mohd waseem waseem
من قبل mohd waseem waseem , game developer , rex info technology

Pointer  is the variable which hold the address of the another variable in memory or it points to location of the variable in memory. In Java ,pointer is deprecated because of memory leak (misusing it like stack overflow)  by overwriting the address which cause compromise your system.

Zeeshan Latif
من قبل Zeeshan Latif , Principal Embedded Systems Engineer , BlueEast-Orient Group of Companies

Pointer is basically holds address of variable in memory.

Ali Alawieh
من قبل Ali Alawieh , Software Engineer (Android) , CME Offshore S.A.L

A pointer is a value that points to an address in memory .

 

Like for example : int *x = fcd8; // would point to  fcd8 address in the memory.

All languages use pointers , it doesn't have to be explicit .But the main reason for languages like Java to "hide them" is to simplify the programmers life.But other reasons could be security , not just protecting programs from hackers , but from the programmer himself. Things can go horribly wrong if you mess up using pointers. You could overwrite data you shouldn't be by simply doing x[ ] =0 in C++ where *( x ) is something you shouldn't be accessing.Try reading about buffer overflow attacks.

 

Also read about passing arguments to functions as parameters or addresses, might make things more clear for you.

 

 

 

المزيد من الأسئلة المماثلة