will this work??

R

Richard

CBFalconer said:
hijkl said:
hey
is anything wrong with this program???

int *array(int n){
return new int(n);
}
int main(){
int *p = array(10);
for( int i = 0; i < 10; i++ ) {
p = 0;
}
printf( "%d\n", p[0] );
p = array(10);
printf( "%d\n", p[0] );
return 0;
}


Yes.


Do you never tire of being such a pedantic, picky, arrogant arse?
 
C

CBFalconer

Richard said:
CBFalconer said:
hijkl said:
is anything wrong with this program???

int *array(int n){
return new int(n);
}
int main(){
int *p = array(10);
for( int i = 0; i < 10; i++ ) {
p = 0;
}
printf( "%d\n", p[0] );
p = array(10);
printf( "%d\n", p[0] );
return 0;
}


Yes.


Do you never tire of being such a pedantic, picky, arrogant arse?


No. Both answers are accurate and responsive.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top