hi, i was learning to allocate memory dynamically as and when needed.my 2 codes got errors.
Code:int main(void){
int *a;
int i=0;
for(i=0;i<10;i++){
a=new int[1];
a[i]=i;
}
}
Code:char *a;
a=new char[1];
a="a";
a=new char[1];
a++;
a="t";
cout<<a; /*expecting a output of at:but only get output of t*/
if some one can correct my errors,its helpfully enough.