473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

I don't understand arrays...please help

2
Hi. I'm a total noob to C++ programming so forgive my stupid questions. Anyway, I don't quite understand arrays yet. How does one enter in data for a 2 dimensional array? input would be GREATLY appreciated...
Nov 10 '06 #1
2 1787
r035198x
13,262 8TB
Hi. I'm a total noob to C++ programming so forgive my stupid questions. Anyway, I don't quite understand arrays yet. How does one enter in data for a 2 dimensional array? input would be GREATLY appreciated...
If you do not understand arrays, then read a tutorial on C++ arrays. There are plenty of them around.
Nov 10 '06 #2
Hi. I'm a total noob to C++ programming so forgive my stupid questions. Anyway, I don't quite understand arrays yet. How does one enter in data for a 2 dimensional array? input would be GREATLY appreciated...
arrays actually are a collection of data. that is u do not need to enter the data again and again. when u define an array it occupies some space in the memory. u can call them memory cells. lets see it with an example. suppose u wrote int arr1[10], that means that your variable arr1 has occupied 10 memory locations in the memory. when u enter data in the array or want to get the output from the array u use looping in order to accomplish this job of yours.
lets write a program to just accept 10 numbers entered through the array.

#include<conio.h>
#include<stdio.h>
{
main()
{
int arr[10],sum,i;
printf("Enter 10 numbers to add");
for(i=0;i<=9;i++)
scanf("%d",&arr[i]);
getch();
}

now in this program what we have done is that we have defined an array of size 10 cells. then we have run a loop to accept the input. when we run the loop we have initialised i from 0 because in c by default array locations is set to 0.
i think now might be having some concept about what array is. u will understand better if u do more and more programming. after ll pracrice makes a man perfect.
Nov 11 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Clint Hill | last post by:
I am working on a project that I would like to have some extensibility for later. So with this I am using interfaces to pass objects to derived classes. However I am running into a situation where...
7
by: tuchka | last post by:
Hi, guys! I am very new here and just started to learn C. I have previous java exp. however. I'm abs. stuck on pointers and i'm unable comprehend algorithm of simple program that reverses chars...
3
by: s.subbarayan | last post by:
Dear all, I encountered the following piece of program: #include <stdio.h> void strprint(char *str); void main() { char *spr="hello"; strprint(spr); }
1
by: Kurt Richardson | last post by:
Hi all Sorry to bother you with what is probably a really trivial question for you C++ experts. My programming skill are pretty amateur, but I'm pretty good at VB.NET. However, I'm wanting to...
3
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
1
by: Anan18 | last post by:
write a program that declares three dimensional arrays named volts, current, and resistance. Each should be declared in main () and should be capable of holding ten double precision numbers. The...
4
by: Christian Maier | last post by:
Hi After surfing a while I have still trouble with this array thing. I have the following function and recive a Segmentation fault, how must I code this right?? Thanks Christian Maier
2
by: Dr Dav | last post by:
Hello all, I'm a physicist whose rewriting a numerical simulation, previously written in IDL, in C with the goal reducing runtime. As you may imagine, my C programming skills are quite poor but I...
9
by: Heck | last post by:
I'm using Visual Studio 2005, but i don't think that's (primarily) where I've gone wrong. I was experimenting, trying, by the way, to move into writing my own iterator so that I can learn,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.