Skip to content

Instantly share code, notes, and snippets.

@fredrb
Created September 10, 2014 20:19
Show Gist options
  • Save fredrb/0bf2d40c4ef6ea5d2040 to your computer and use it in GitHub Desktop.
Save fredrb/0bf2d40c4ef6ea5d2040 to your computer and use it in GitHub Desktop.
sort.c
#include<stdio.h>
#include<stdlib.h>
void print_array( int *arr , int size );
int main() {
int a[10] = { 2, 7, 3, 4, 5, 6, 1, 8, 9, 10 };
print_array(a, sizeof(a) / sizeof(int));
return 0;
}
void print_array( int *arr, int size ){
int i, j;
for( i = 0 ; i < size ; i++){
printf("Pos %i = \t", i);
for( j = 0 ; j < arr[i] ; j++){
printf("*");
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment