C language - BIL104E INTRODUCTION TO SCIENTIFIC AND...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
BIL104E INTRODUCTION TO SCIENTIFIC AND ENGINEERING COMPUTING (C) WEEK – 6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
One dimensional arrays: An array is a collection of variables that are of the same data type Datatype: integer Array-Name: array_int Array-Size: 8 Data-type: character Array-Name: day Array-Size: 7 array elements: i++
Background image of page 2
Example Output: int array[6]; for(i=1; i<=6; i++){ array_int[i] = i*i; printf(“array[ %d ] = %d * %d = %d \ n”, i , i , i , array_int[i] ); } array[ 1 ] = 1 * 1 = 1 ; array[ 2 ] = 2 * 2 = 4 ; array[ 3 ] = 3 * 3 = 9 ; array[ 4 ] = 4 * 4 = 16 ; array[ 5 ] = 5 * 5 = 25 ; array[ 6 ] = 6 * 6 = 36 ;
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Multidimensional arrays i=0 j=0 i=0 j=1 i=0 j=2 ..... ..... . ..... ..... i=0 j=7 i=1 j=0 i=1 j=1 i=1 j=2 ..... ..... ..... ..... i=1 j=7 . . . . . . . . i=4 j=0 i=4 j=1 ..... ..... ..... ..... i=4 j=6 i=4 j=7 Datatype: integer Array-Name: array_int Array-Size1: 5 Array-Size2: 8 int array_int[5][8] for(i=0; i<5; i++){ for(j=0; j<8; j++); array_int[i][j] = i*j; printf(“array_int[%d][%d]=%d \ n”,i,j, array_int[i]);
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/22/2010 for the course BIL 104 taught by Professor Abc during the Fall '09 term at Istanbul Technical University.

Page1 / 8

C language - BIL104E INTRODUCTION TO SCIENTIFIC AND...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online