need help for saving in array

Status
Not open for further replies.

sanna

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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…