Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: C  |  size: 5.95 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. //#include <math.h>
  5. #include "functions.h"
  6.  
  7. int main() {
  8.   srand(time(NULL));
  9. /*
  10.   int size_a = 3;
  11.   int size_b = 2;
  12.  
  13.   int a[size_a];                                                                                                                                                                                              
  14.   int b[size_b];                                                                                                                                                                                              
  15.                                                                                                                                                                                                                
  16.   a[0] = 1;                                                                                                                                                                                                    
  17.   a[1] = 2;                                                                                                                                                                                                    
  18.   a[2] = 5;                                                                                                                                                                                                    
  19.                                                                                                                                                                                                                
  20.   b[0] = 12;                                                                                                                                                                                                  
  21.   b[1] = 4;                                                                                                                                                                                                    
  22.                                                                                                                                                                                                                
  23.   printf("A : \t");                                                                                                                                                                                            
  24.   show_tab(a, size_a);                                                                                                                                                                                        
  25.                                                                                                                                                                                                                
  26.   printf("B : \t");                                                                                                                                                                                            
  27.   show_tab(b, size_b);                                                                                                                                                                                        
  28. */                                                                                                                                                                                                            
  29.   /*                                                                                                                                                                                                          
  30.   int size = 3;                                                                                                                                                                                                
  31.   int min = 1;                                                                                                                                                                                                
  32.   int max = 9;                                                                                                                                                                                                
  33.                                                                                                                                                                                                                
  34.   int* tab = init_tab(size);                                                                                                                                                                                  
  35.   printf("tab = \t");                                                                                                                                                                                          
  36.   show_tab(tab, size);                                                                                                                                                                                        
  37.   tab = fill_rand(tab, size, min, max);                                                                                                                                                                        
  38.   printf("fill \ntab = \t");                                                                                                                                                                                  
  39.   show_tab(tab, size);
  40.  
  41.   tab = add_gap_left(tab, size);
  42.   printf("add_gap_left(tab,%d) \n", size);
  43.   printf("tab = \t");
  44.   show_tab(tab, size+1);
  45.  
  46.   tab = remove_first(tab,size+1);
  47.   printf("remove_first(tab,%d) \n", size+1);
  48.   printf("tab = \t");
  49.   show_tab(tab,size);
  50. */
  51.   int* tab;
  52.   tab = malloc(tab, sizeof(int) * 2);
  53.   tab[0] = 2;
  54.   tab[1] = 3;
  55.   show_tab(tab,2);
  56.   tab = insert_tab(1, tab, 2);
  57.   show_tab(tab;5);
  58.  
  59.   free(tab);
  60.   return 0;  
  61. }