Trusted by millions of Kenyans
Study resources on Kenyaplex

Get ready-made curriculum aligned revision materials

Exam papers, notes, holiday assignments and topical questions – all aligned to the Kenyan curriculum.

Show how to allocate a float and an int by using new. Also, show how to free them by using delete.

Show how to allocate a float and an int by using new. Also, show how to free them by using delete.

Answers


Davis
#include
using namespace std;
int main()
{
float *f;
int *i;
if(!f || !i) {
cout << "Allocation error \n";
return 1;
}
*f = 10.101;
* = 100;
cout << *f << ' ' <<*i << '\n';
deldelete i;
return 0;
}
Githiari answered the question on May 29, 2018 at 18:06

Answer Attachments

Exams With Marking Schemes

Related Questions