[ create a new paste ] login | about

Link: http://codepad.org/8tfxttNy    [ raw code | output | fork ]

C, pasted on Sep 29:
#include <stdio.h>
#include <stdlib.h>
#define LENGTH 10
#define RANGE 10
void init(int *arr)
{
  *(arr+LENGTH) = -1;
  while(*arr != -1) *(arr++) = rand()%RANGE;
}

void show(int *arr)
{
  while(*arr != -1) printf("%d ", *(arr++));
  puts("");
}

int main(void)
{
  int *arr = malloc(sizeof(int) * LENGTH);
  init(arr);
  show(arr);

  return 0;
}


Output:
1
3 6 7 5 3 5 6 2 9 1 


Create a new paste based on this one


Comments: