Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. int *array1=new int [3];
  2. void My_function()
  3. {
  4. My_set(array1);
  5. for(int i=0;i<3;i++){ //The output is 5 15 55
  6. cout<<array1[i]<<endl;
  7. }
  8. Display (array1)
  9.  
  10. }
  11.  
  12. void My_set(int *array1)
  13. {
  14. array1[0]=5;
  15. array1[1]=15;
  16. array1[2]=55;
  17. }
  18.  
  19. void Display(int *array1){
  20. for(int i=0;i<3;i++){
  21. cout<<array1[i]<<endl; //The output is Garbage -842150451
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement