gpsgiraldi

_2024_@19_01

Oct 12th, 2024
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | Source Code | 0 0
  1. /*Exercício 1: Troca de Valores
  2. Crie uma função que troque os valores de duas variáveis inteiras usando ponteiros.*/
  3.  
  4. #include <stdio.h>
  5.  
  6. void proced(int *refa,int *refb){
  7.     *refa = 20;
  8.     *refb = 80;
  9. }
  10.  
  11. int main()
  12. {
  13.     int a=10,b=40;
  14.  
  15.     int *p=&a,*q=&b;
  16.  
  17.     proced(p,q);
  18.  
  19.     printf("%d %d \n",a,b);
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment