انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

lec2:: DERIVED TYPES

Share |
الكلية كلية العلوم للبنات     القسم قسم الحاسبات     المرحلة 2
أستاذ المادة اسراء عبد الله حسين علي الدليمي       28/05/2018 18:52:45
DERIVED TYPES::
Array and struct are derived types in C. They are more complex than primary. An array is defined as finite ordered collection of homogenous data, stored in contiguous memory locations.
• finite means data range must be defined.
• ordered means data must be stored in continuous memory addresses.
• homogenous means data must be of similar data type.
Declaring an Array
Like any other variable, arrays must be declared before they are used. General form of array declaration is,
data-type array-name[size];
/* Example of array declaration */
int arr[10];


Struct
Structure is allow us to combine data of different types together in C language. It is somewhat similar to an Array, but an array holds data of similar type only. Structure on the other hand, can store data of any type which is practical more useful.
For example: If I have to write a program to store Student information, which will have Student s name, age, branch, permanent address, father s name etc, which included string values, integer values etc, how can I use arrays for this problem, I will require something which can hold data of different types together. In structure, data is stored in form of records.


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم