C++ Programming Questions


Q.  Which of the following is/are valid ways to allocate memory for an integer by dynamic memory allocation in CPP?

a. int *p = new int(100);
b. int *p; p = new int; *p = 100;
c. int *p = NULL; p = new int; *p=100;
d. Only 1,2
e. All of these



 
 

    Discussion

Post your comment / Share knowledge