Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help required on array operation in C

Status
Not open for further replies.

mformazhar1980

Junior Member level 1
Joined
Mar 23, 2009
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,436
hi

i need to do some operation on an array in my program but dont know how to do that.
can any body help me out of this situation.

actually i am filling an array with boolean data that is 0's and 1's during a while loop.
what i want that after getting filled with unknown values i should be able to separate the array element. the

code snippet shows the while loop that is filling the required boolean array as per condition
Code:
 bool Value[1000];
int ctr=0;
 
while(ctr<1000 && Pulse_Line_Cnt ==156)

{
Value[ctr]= PC7;  // PC7 is a variable that has a randam boolean data 
ctr++;
}

now i dont know how to process it further i mean after getting filled Value[ctr] with 0's and 1's i need to

separate all 0 values and all 1 values from this array.

the data i am expecting in the array are supposed to be first 1's then 0's and then 1's then 0's again
so its not only separating the elements but also like i should know how many 0's appear before the 1's and

after that how many 1's appear after next bunch of 0's and so on untilthe end of array.after gettig the exact

number of 0's and 1's can be stored in any integer variable for further treatment.

can some body help me of this thanks. i am attaching a picture to clarify my point

thanks
 

Do bitwise & and | operation with ur boolean date and store it
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top