8/3/10

Tarea apuntadores

#include <iostream>
using namespace std;


int funcion1(int variable_local){
    variable_local=5;
    return variable_local;
int a=funcion1(variable_local);
cout<<"Variable local = "<<variable_local<<endl;
    cout<<"a= "<<a<<endl;
}
char funcion2(int *p)
{
    if (*p==5)
    {
        p = new int[15];
    }
    while (*p)
    {
 p=0;
 p++;
    }
}
int main ()
{
    int *variable_local;
    variable_local = new int;
    char*x;
    int*y;
    y=new int [15];
    char nombre_array[20];
    x=nombre_array;
int b=1;
    while (x)
    {
        cout<<b++;
        *x++;
        cout<<"*x="<<*x<<endl;
    }
    *variable_local=5;
funcion1(*variable_local);
funcion2(variable_local);
system ("pause");
return 0;
}

No hay comentarios:

Publicar un comentario