I am new to programming, but I am trying to create two arrays, arrX and arrY. Then use scanf to insert intialnum amount of elements into each array. That is the easy part.

Where I am having trouble is when I try to pull the first element in each array [0] and send it into a function (if it is negative it is compared, converted to unsigned, and sent to the respective function). Increment to the next element, and then jump to the next array and do the same thing.

``````...
for(c=0;c < InitialNum;c++)
{
if(arrX[I] < 0) ////if array element value is negative...
{
m = ~(arrX[I]);//convert to unsigned
m == m+1;
ccwX(m);
I++;//increment to next element????
}
else
{
n = (arrX[I]);
cwX(n);
}
I++;
if(arrY[K] < 0)
{
o = ~arrY[K];
o = o+1;
ccwY(o);
}
else
{
p = (arrY[K]);
cwY(p);
}
K++;
}
puts("Process completed\n\r");
}``````

1> DO PROPER INDENTATION TO YOUR CODE.

2> line #7
It should be an assignment(=) statement and not a comparison(==).

First of all, format your code so it can be followed.
This code:

``````m = ~(arrX[I]);//convert to unsigned
m == m+1;``````

does not convert to unsigned. `m == m+1;` is a comparison. Since you know `arrX[i]` is negative, just do `arrX[i] = -arrX[i];`

Thanks Walt, it was a typo, but I appreciate it. I am new to the forums obviously (first posts) so please bare with me a little on my formatting. I follow you folks on the assignment operation, but this array thing is killing me. I can't seem to get it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.