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.

need help for saving in array

Status
Not open for further replies.

sanna

Member level 2
Member level 2
Joined
Jul 19, 2007
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,658
I am not very good in software and trying to save my signal in an array and sort it from smal to big and array size is 10.
I have a signal for example x=1 and want to save t in array when it comes. but my code doesn't work. Any suggestions, Thanks

#include<stdio.h>


int i,j;
int array[10];

int sort(int sample);

int main()
{

int HEART,LEVEL;

printf("give a value to heart:");
scanf("%d",&HEART);

printf("give a value to level:");
scanf("%d",&LEVEL);

if (HEART>=LEVEL)
{
int sort(HEART);
}


int sort(int sample) {
int i,j;

for (j = 1; j < 10; j++) {
sample = array[j];
for (i = j-1; i >= 0 && array > sample; --i) {
array[i+1] = array;
}
array[i+1] = sample;
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top