Notification texts go here Contact Us Buy Now!
المشاركات

C++ এ Pointers কী?

 আজকের Tutorial এ আমি c++ এর pointers নিয়ে আলোচনা করবো।প্রথমেই জেনে নেয়া যাক Pointer কী? pointer হলো এক ধরনের Data Type যা অন্য একটি Data Type এর Address স্টোর করে।আমরা যখন কোনো variable বানাই তখন এটি ram এ স্টোর করা থাকে আর র‍্যাম এ যেখানে স্টোর থাকে সেই ঠিকানাই হলো address ।অর্থাৎ,কোনো variable এর address যেখানে স্টোর করা হয় সেটিই হলো Pointer 

Pointer কেন প্রয়োজন ?

function বা class এর ভেতর যখন আমরা কোনো variable নিয়ে কাজ করি তখন সেগুলো local variable হয়।এক্ষেত্রে সেখানে কোনো variable এর value reassign করলে main function এ থাকা variable এর value change হয় না।এজন্য pointers ব্যবহার করে আমরা যেকোনো function এ variable এর address pass করে সেই variable টির value change করতে পারি।

এবার Pointers সম্পর্কে বিস্তারিত জেনে নেয়া যাক 😊

pointers সম্পর্কে জানার আগে আমাদের দুটি operator সম্পর্কে জানতে হবে।সেগুলো হলো:


& → address of operator


* → dereference operator


কোনো variable এর address জানতে হলে আমরা & operator use করি।যেমন কোনো variable যদি হয় a তাহলে এর address হবে &a


এবার * operator সম্পর্কে জেনে নেয়া যাক।* operator ব্যবহার করে আমরা pointer variable declare করবো আবার * ব্যবহার করে pointer variable থেকে original variable এর value পাবো



إرسال تعليق

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.