Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 10th, 2012  |  syntax: None  |  size: 0.21 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void List::add(int x){
  2.         size++;
  3.         int *temp=new int[size-1];
  4.         for(int i=0;i<size-1;i++)
  5.                 temp[i]=data[i];
  6.  
  7. delete [] data;
  8. data=new int[size];
  9.  
  10.         for(int i=0;i<size-1;i++)
  11.                 data[i]=temp[i];
  12.         data[size-1]=x;
  13. }
clone this paste RAW Paste Data