eHow launches Android app: Get the best of eHow on the go.

How to Initialize an Array

Video Preview

Summary: Initialize an array by creating a program that includes an iostream, an array of integers and an initialization loop. Run the output for a program to see whether the array runs correctly with help from a software developer in this free video on computers.

Views:
180
Presenter
By Dave Andrews
eHow Presenter

Dave Andrews is a software developer with a business and Web site selling programs and other computer services in Franklin, Tenn. Having worked in the IT industry for more than 8...read more

Post a Comment

Post a Comment

Video Transcript

"Hi, my name is Dave Andrews. Today I'm going to show you how to initialize an array. Let's go to our computer and I have a little program here. The first thing I've done is include iostream which is a C method of or gives us the objects to print data out to the screen like this STD cout object is available in iostream. The very first thing that I do in my main function is I create an array of 5 integers which will store 5 numbers in memory. Now this next for loop is my initialization loop. It basically loops through that array and it sets each value of the object to the current number. So j is going to go from 0 to 5 which means it will be 0, 1, 2, 3, 4 and each of those val objects will be assigned to the current number. So if I go back afterwards and print out those values in my next for loop here, it should basically print out the values that are in the val array which is going to be 0 through 4. So I'm going to compile my program here for you and I'm going to show you that my array has successfully been initialized in this for loop here. Now that my program is compiled, I'm going to run the output and as you can see, I get the values 0 through 4 as output from my array. My name is Dave Andrews and I've just showed you how to initialize an array."

eHow Article: How to Initialize an Array

Related Ads

  • Have you done this? Click here to let us know.
Computers
Alexia Petrakos,

Meet Alexia Petrakos eHow's Computers Expert.

Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

eHow Computers
eHow_eHow Technology and Electronics