انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية العلوم للبنات
القسم قسم الحاسبات
المرحلة 2
أستاذ المادة اسراء عبد الله حسين علي الدليمي
28/05/2018 19:00:06
Pointer Arithmetic Increment operator when used with a pointer variable returns next address pointed by the pointer. The next address returned is the sum of current pointed address and size of pointer data type. Or in simple terms, incrementing a pointer will cause the pointer to point to a memory location skipping N bytes from current pointed memory location. Where N is size of pointer data type. Similarly, decrement operator returns the previous address pointed by the pointer. The returned address is the difference of current pointed address and size of pointer data type. For example, consider the below statements:: int num = 5; // Suppose address of num = 0x1230 int *ptr; // Pointer variable ptr = # // ptr points to 0x1230 or ptr points to num ptr++; // ptr now points to 0x1234, since integer size is 4 bytes ptr--; // ptr now points to 0x1230
Note: Increment operation increments pointer address by the size of pointer data type. If an integer pointer ptr pointing at 0x1230, after ptr++ it will point at 0x1234(assuming integer size is 4 bytes). If a character pointer cptr pointing at 0x1250, after cptr++ it will point at 0x1251(since character occupies 1 byte).
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم
|