If anyone wants to look at my code so far and give me any pointers, that would be awesome!
Here is what I have to do:
Write a program that does the following:
1. The program will create an array of 100 integers.
2. It will initialize the elements at index 0 and 1 to 0, and all other elements to 1.
3. The program will print the index of every element of the array that has the value 1.
4. Write a function initialize_array that accepts two arguments, an array of integers and an
integer that is the size of the array. This function will be called from main to assign values to
the array.
5. Write a function print_array that accepts two arguments, an array of integers and an integer
that is the size of the array. This function will be called from main to print the index of all
elements that do not have the value 0.
This is how I started, I am trying to look at examples in the book and see if I can figure it out that way.
#include <stdio.h>
#include "csc1325.h"
#define SIZE 100
int initialize_array(int a[], int size);
int print_array(int b[], int size);
int main (int argc, char * argv[]) {
int c[SIZE] =
{ 0,0,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1, };
return 0;
}


Sign In
Create Account


Back to top









