অনুরূপ অনেক Data একসাথে স্টোর করতে array এর ব্যবহার

Submitted by tushar pramanick on Mon, 01/02/2012 - 15:52

Storing Similar Data Items

In last Chapter you learned about pointers and the concept of indirection. In this lesson you'll learn about arrays, which are collections of similar data items and are closely related to pointers. The main topics covered in this lesson are

    Single-dimension arrays
    Indexing arrays
    Pointers and arrays
    Character arrays
    Multidimensional arrays
    Unsized arrays



Summary

In this lesson you've learned the following:

  •     An array is a collection of variables that are of the same data type.
  •     In C, the index to an array starts at 0.
  •     You can initialize each individual element of an array after the declaration of the array, or you can place all initial values into a data block surrounded by { and } during the declaration of an array.
  •     The memory storage taken by an array is determined by the product of the size of the data type and the dimensions of the array.
  •     A pointer is said to refer to an array when the address of the first element in the array is assigned to the pointer. The address of the first element in an array is also called the start address of the array.
  •     To assign the start address of an array to a pointer, you can either put the combination of the address-of operator (&) and the first element name of the array, or simply use the array name, on the right side of an assignment operator (=).
  •     A character array is considered a character string in C if the last element in the array contains a null character (\0).
  •     The null character (\0) marks the end of a string. C functions, such as printf(), will stop processing the string when the null character is encountered.
  •     C supports multidimensional arrays, too. A pair of brackets (the array subscript operator—[ and ]) indicates a dimension.
  •     The compiler can automatically calculate the memory space needed by an unsized array.

 

 

Related Items

Question and Answer

Question and Answer

    Q Which bit can be used as the sign bit in an integer?

Exercises : Answer the following Question

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.

Measuring Data Sizes

Measuring Data Sizes

What Does x?y:z Mean?

What Does x?y:z Mean?

In C, ?: is called the conditional operator, which is the only operator that takes three operands. The general form of the conditional operator is

Using Shift Operators

Using Shift Operators

There are two shift operators in C. The >> operator shifts the bits of an operand to the right; the << operator shifts the bits to the left.

The general forms of the two shift operators are

x >> y