Skip to content

Instantly share code, notes, and snippets.

@awareness481
Created May 29, 2017 16:12
Show Gist options
  • Save awareness481/f3dfa6c53df88f36bf6378e45da12872 to your computer and use it in GitHub Desktop.
Save awareness481/f3dfa6c53df88f36bf6378e45da12872 to your computer and use it in GitHub Desktop.
control may reach end of non-void function [-Werror,-Wreturn-type] }
#include <cs50.h>
#include <string.h>
#include "helpers.h"
#include <stdio.h>
/**
* Returns true if value is in array of n values, else false.
*/
bool search(int value, int values[], int n)
{
// TODO: implement a searching algorithm
if (n < 1) {
return false;
}
sort(values, n);
}
/**
* Sorts array of n values.
*/
void sort(int values[], int n) {
if (n == 1) {
}
int left[n/2];
int right[n/2];
memcpy(left, values, sizeof left);
memcpy(right, values + n/2, sizeof right);
for (int i = 0, n = sizeof( right ) / sizeof( right[0]); i < n; i++) { //test
printf("%d", right[i]);
}
}
/**
* helpers.h
*
* Helper functions for Problem Set 3.
*/
#include <cs50.h>
/**
* Returns true if value is in array of n values, else false.
*/
bool search(int value, int values[], int n);
/**
* Sorts array of n values.
*/
void sort(int values[], int n);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment