I am attempting to write a program with several functions( 6 ) anda unique data
ID: 3618460 • Letter: I
Question
I am attempting to write a program with several functions( 6 ) anda unique data set for each. Unfortunately i am gettting hung up inthe beginning. The instructions for the first function are asfollows;Write a function that receives an array of integers >= inparameter and return a compacted version of the array containingonly the values >0.
So basically i just eliminate the zeros (and i suppose negativenumbers, but there wont be any) from an array. An array which theuser inputs.
Here is what i have so far, any more help would be appreciated,thanks!
#include<stdio.h>
#include<math.h>
#define SIZE 81
void array_easy( int a[]);
int main(){
int value[SIZE] = {5,6,3,4,0,0,1,2};
array_easy(value);
return 0;
}
void array_easy(int a[]){
int i;
int hold =0;
for(i=0; i < SIZE; i++){
if(i <= 0){
i =+ hold;
}}
printf(" This is the array with numbers greater than zero ");
for(i=0; i < SIZE; i++){
printf("%d",a[i]);
}
printf(" ");
//return a[i];
}
Explanation / Answer
please rate - thanks #include #include #include #define SIZE 8 ////////// void array_easy( int a[]); int main(){ int value[] = {5,6,3,4,0,0,1,2}; array_easy(value); getch(); return 0; } void array_easy(int a[]){ int i,j,n; n=SIZE; for(i=0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.