Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int arreglo[10] = {10,20,30,40,50,60,70,80,90,100};
- mostrarArreglo2(arreglo,10,0);
- return 0;
- }
- int suma (int a, int b)
- {
- int c = a + b;
- return c;
- }
- //llamado recursivo
- //condicion de corte
- //acercamiento a la condicion de corte
- //NO podemos poner WHILE O FOR
- void mostrarArreglo(int arreglo[10],int DIM,int pos)
- {
- if (pos < DIM)
- {
- printf("estamos en la posicion %d\n",pos);
- printf("A: %d\n",arreglo[pos]);
- mostrarArreglo(arreglo,DIM,pos+1);
- }
- }
- void mostrarArreglo2(int arreglo[10],int DIM,int pos)
- {
- if (pos < DIM)
- {
- mostrarArreglo2(arreglo,DIM,pos+1);
- printf("A: %d\n",arreglo[pos]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement