can i direct dynamic memory to a function??
like:
p[1]=function1();
??
yes if the return value of function is same as type of variable which is used in array
what if all the function has return 0; ?
then ur array variable should be int type (or double or float)
post whole code please, its ridiculous to set value of array variable like that
u could then do like this
p[1]=0;
here is my code..
cout<<"\t\t\tEnter your choice: ";
cin>>n;
if (n>0 && n<=5)
{
p= new (nothrow) int[6];
p[1]=scorecalcu();
p[2]=assignment();
p[3]=prelim();
p[4]=midterm();
p[5]=final();
}
else
{
if (n=='B' || n=='b')
{
system ("cls");
startup();
}
else
{
cout<<"wrong input!";
system ("pause");
system ("cls");
grade();
{
}
return 0;
it returns an error of :
local function definitions are illegal