# Thread: Frustrated cant figure this simple thing out

1. ## Frustrated cant figure this simple thing out

Need to create two arrays of integers subtact the two then store results into a third array. Then print all 3 arrays. Here is the jumbled crap i have. Hope Someone can help!
insert
Code:
```#include <stdio.h>

int main()
{
int i, f;

#define nums 10
int nums [] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};

#define num 10
int num [] = {2, 3, 4, 5, 6, 7, 8 ,9 ,10};

#define totes 10
int totes[];

for (i=0, i<nums, i++, f=0, f<num, f++)
nums[f] - num[i] = totes[];

printf( "the results of the arrays are: %d\n", totes);
printf( "array one is: %d\n", nums);
printf( "array two is: %d\n", num);

return 0;
}

```

2. 1. define array length once

Code:
`#define MAX_NUM 10`
2. declare 3 arrays of the dame size

Code:
```int nums [MAX_NUM] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
int num  [MAX_NUM]  = {2, 3, 4, 5, 6, 7, 8 ,9 ,10};
int totes[MAX_NUM];```
3. assignment works from right to left
Code:
`totes[i] = nums[i] - num[i];`
4. to print array you need to use the loop as well

3. Got everything to compile...now i just cant remember how to make my results show up in command prompt

4. Somebody should delete those horrible sections named

• "A poor-mans method of using system, OS specific:"
• "A compiler specific implementation using getch:"
• "A Unix specific method using terminal modes"

Why have non-portable stuff in there?

5. Originally Posted by SirPrattlepod

Why have non-portable stuff in there?
Because not all programmers need portable stuff? Some are programming for specific target?

6. Originally Posted by vart
Because not all programmers need portable stuff? Some are programming for specific target?
But, it's teaching beginners bad practices where it's not necessary