1. ## Now I need help adding arrays

So lets say that I want to add arrays, How would I go about doing this. So the array would have a size limit of 7 so it would be something like.. int array[7] or would be it size = 7; array[size]? Then how would I go about adding these integers? Would I store another variable in the array's? Like so if I wanted a total of seven array sizes, like array[1][2][3][4][5][6][7]; would i have like 7 different variables , like a,b,c,d,e,f,g,h? or something like that and assign each variable to the array? I'm just very confused.... need help, lots of help. Need the C programming pro's to help me. I feel so lost... so lonely..

2. First you have to figure out what you mean when you say "adding arrays". Do you mean you have two arrays and you want to add them, piece-by-piece? Do you have one array and you want to add all the elements? Do you have two arrays, and you want to glue them together into one big array? Or none of the above?

3. So you want to sum up an entire array?

Code:
```int sum, i;

for(i = 0, sum = 0; i < size; i++)
sum += array[i];```
Or am I misunderstanding?

4. Well here is the example that I got from my friend... he made a bet with me that I wouldn't understand array (which I don't) before he comes back on wednesday. So I need to finish this stupid program that he made so I don't lose the bet, very stupid bet, but its just something for us to pass time with.... (sorry i'm a very big newb).

Code:
```
#include <stdio.h>
#include <stdlib.h>

// function declarations
int rawr1(int s, int arr[]);
int rawr2(int s, int arr[]);
int rawr3(int s, int arr[]);

int main(void) {
int x;
int size = 7;
int ar[] =  { 2, -5, 13, 6, 4, 2, 2 };
int ar2[] = { 2, -5, 6, 13, 4, 2, 4 };
int ar3[] = { 2, 3, -5, 6, 4, 4, 13 };
int ar4[] = { 2, 2, 4, 4, 2, 13, 7 };
// Call a function at the end of this function.
x = rawr1(size, ar);
printf("rawr1 returned %d\n", x);

// Call functions in a different file.
x = rawr2(size, ar);
printf("rawr2 returned %d\n", x);

x = rawr3(size, ar);
printf("rawr3 returned %d\n", x);

x = rawr3(size, ar2);
printf("rawr3 returned %d\n", x);

x = rawr3(size, ar3);
printf("rawr3 returned %d\n", x);

x = rawr3(size, ar4);
printf("rawr3 returned %d\n", x);

exit (EXIT_SUCCESS);
}

int rawr1(int s, int arr[]) {
}

int rawr2(int size, arr[]){
// and I have no idea what to do here as well
}

int rawr3(int size, arr[]){
// and finally no freakin idea what to do here...
}```

5. Feel free to also check out google.

6. I read the lesson, but i barely helps me.. I'm literally a blind newb that has no programming experience except for like 2 VERY VERY VERY VERY BASIC programs... like adding 2 numbers.

7. Then why did you accept the bet, if you cannot program?
I hate to bring this up, but us writing the program for you would be "cheating."
I am still assuming you were to sum up every number in that array.
So, what parts of the lesson did you not understand?

8. Well, its not cheating. i'm just asking for help and to understand more about arrays... I understand the

for loop and how your storing the x and y into the two dimension and then you set that array to x * y. I understand that as well. But what is cout? that place I get lost.

9. This is actually C++, but cout prints stuff to the screen. Basically.
You do not need to really worry about that, but more about getting the understand of how arrays work and behave.

10. Thats what I'm trying to understand.

11. Indeed you are and the tutorial explains it very well how arrays work.
You have the array, and you have the size of the array.
If you were given a bunt of papers in real life, and the number of papers, and on each of those papers is a number. Take those numbers and add them up. How would you do that in real world?
Type it in pseudo code first.

12. Ahhh, thank you very much! YOU TRULY ARE THE PROGRAMMING GODDESS!

13. Why not wait until you are comprehending what an array is before starting a new thread asking how to perform select task on an array. In my professional opinion, even if you got your code to work it does not demonstrate an understanding of what an array is or does.

14. Originally Posted by nifear4
Ahhh, thank you very much! YOU TRULY ARE THE PROGRAMMING GODDESS!
*sigh* that one will probably make the sig. Yet mine never do... though I suppose mine tend to sound a little sarcast or underwhelming.