Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.42 KB  |  views: 13  |  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. int ran1;
  2. int ran2;
  3. int ran3;
  4.        
  5. for(int k=0;k<3;k++)
  6.  ran%k=k; // this is wrong ,but i am looking for the correct way .
  7.           //output should be :ran1=0 ran2=1 ran3=2..
  8.        
  9. int ran[3];
  10.  
  11. for (int k = 0; k < 3; k++)
  12. {
  13.     ran[k % 3] = k;
  14. }
  15.        
  16. int ran1, ran2, ran3;
  17.  
  18. int *rans[3] = { &ran1, &ran2, &ran3 };
  19.  
  20. for (int k = 0; k < 3; k++)
  21.   *rans[k] = k;
  22.        
  23. int ran[3];
  24. for(int k=0;k<3;k++)
  25.  ran[k]=k;
  26.        
  27. ran[k % 3] = k;