Advertisement
raulgarcia

vectores en c

May 31st, 2021
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. //otro ejemplo de vectores con punteros
  2. // mayo 2021
  3.  
  4. #include "stdio.h"
  5.  
  6. void pide(int *vector);
  7. void imprime(int *vector);
  8.  
  9. int main(){
  10. int vector[10];
  11.  
  12. pide(vector);
  13. imprime(vector);
  14. }
  15.  
  16. void pide(int *vector){
  17. for (int i = 0;i < 10; ++i)
  18. {
  19. /* code */
  20. printf("Dime un numero del 1 al 6:");
  21. scanf("%i",(vector+i));
  22. }
  23. }
  24.  
  25. void imprime(int *vector){
  26. for (int i = 0; i < 10; ++i)
  27. {
  28. /* code */
  29. printf("\n%i:%i",i+1,*(vector+i) );
  30. if (*(vector+i)==1){
  31. printf("Uno");
  32. }
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement