UNIDAD 7: C++ APUNTADORES

TEMA 4: APUNTADORES A ARREGLOS C++


Tambien solo se ocupa una variable apuntador normal.

Caso A.


main()

{
int x[5]={1,2,3,4,5};

int *y,renglon;

y = x;

printf("%d %d %d",x[1],*y,*(y+1));

for(renglon =0; renglon <= 4; renglon ++)

printf("%d",*(y+renglon));

}

Caso B.


main()

{

int reng;

float *x = malloc(5*sizeof(float));

*(x+2) = 3.14159;

printf("%f",*(x+2);

for(reng = 0; reng <=4; reng ++)

printf("%f",*x++);

free(x);

}

TAREAS PROGRAMACION C++ Capturar en arreglos matriculas y 3 calificaciones de 6 alumnos, calcular arreglo promedio, imprimir matricula y promedios aprobatorios, apuntadores y malloc.

TAREAS PROGRAMACION C++ Inicializar una lista de apuntadores float, sortear ascendentemente, desplegar original y copia.

 




Google
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Politica de Privacidad