NeroReflex

scambio lettere

Apr 22nd, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void scambia(char *x, char *y) {
  5.     char temp = *x;
  6.     *x = *y;
  7.     *y = temp;
  8. }
  9.  
  10. int main() {
  11.     char messaggio[5] = { 'i', 'c', 'a', 'o', '\0' };
  12.    
  13.     scambia(&messaggio[0], &messaggio[0]+1);
  14.    
  15.     cout << &messaggio[0];
  16.    
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment