×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

by: Nhi Phan

60

0

3

# ENEE 140 (C language) : Arrays ENEE140

Marketplace > Montgomery College > Electrical Engineering > ENEE140 > ENEE 140 C language Arrays
Nhi Phan
Montgomery College
GPA 4.0

Enter your email below and we will instantly email you these Notes for Introduction to programming concepts for engineers

(Limited time offer)

Unlock FREE Class Notes

### Enter your email below to receive Introduction to programming concepts for engineers notes

Everyone needs better class notes. Enter your email and we will send you notes for this class for free.

Helpful definitions & explanations & example
COURSE
Introduction to programming concepts for engineers
PROF.
Dr.Lanxiang
TYPE
Class Notes
PAGES
3
WORDS
CONCEPTS
programming for engineers
KARMA
Free

## Popular in Electrical Engineering

This 3 page Class Notes was uploaded by Nhi Phan on Wednesday April 6, 2016. The Class Notes belongs to ENEE140 at Montgomery College taught by Dr.Lanxiang in Spring 2016. Since its upload, it has received 60 views. For similar materials see Introduction to programming concepts for engineers in Electrical Engineering at Montgomery College.

×

## Reviews for ENEE 140 (C language) : Arrays

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 04/06/16
Lecture 7: Arrays An array variable is a set of variables  share a common name and type  all linked together int x[30]; /* 30 integers */ elements: x[0], x[1], ..., x[29] name of array is x array size: total 30 elements in array ‘x’ it has to be an integer with known value (to determine the memory needed to store the array) each element is int type starts from 0 Array Elements #include <stdio.h> int main( void ) { int i, n[10]; /* n is an array of 10 integers */ for( i = 0; i < 10; i ++ ) { /*loop 10 times*/ n[i]= 2; /* set all elements to 2 */ printf( "n[%d] = %d\n" , i, n[i] ); /*display value of n[i] */ } n[1] = 5; n[3] = n[1] + n[0]; printf( "Enter an integer value: " ); scanf( "%d", &n[5] ); printf( "Element 3 is %d\n", n[3]); /*display element 3 */ printf( "The sixth element is %d\n", n[5]); /*display 6th element*/ return 0; } Example 1: Find the minimum #include <stdio.h> #define SIZE 10 int main( void ) { int i, min, x[SIZE]; for( i = 0; i < SIZE; i ++ ) { /*loop 10 times*/ printf("Enter an integer: "); scanf( "%d", &x[i]); /* read each element */ } min = x[0]; for( i = 1; i < SIZE; i ++ ) { if (x[i] < min) min = x[i]; } printf( "The minimum is %d\n", min); return 0; } Initializing arrays type name[n] = {value0, value1, ... , value(n-1)}; double height[3] = {5.5, 6.3, 5.8}; int x[] = {1, 2, 3, 4, 5}; If all the initial values are given, the number of elements can be omitted. Compiler will count the number of elements and set size of array ‘x’ to 5 Three elements of array ‘height’ are initialized to 5.5, 6.3, and 5.8. Each element is double type. int y[5] = {1, 2}; First two elements y[0] and y[1] are initialized to 1 and 2. Remaining elements [2]-[4] are initialized to zero implicitly.

×

×

### BOOM! Enjoy Your Free Notes!

×

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Jim McGreen Ohio University

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Kyle Maynard Purdue

#### "When you're taking detailed notes and trying to help everyone else out in the class, it really helps you learn and understand the material...plus I made \$280 on my first study guide!"

Jim McGreen Ohio University

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Parker Thompson 500 Startups

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com