#include
int* fib(int);
int main()
{
int count;
std::cout<<\"enter number up to which fibonacci series is to be printed\"<
Several issues with your code
for(i<0;i<=count;i++)
should actually be
for(i=0;i
and
for(j=0;j<=d;j++)
must read
for(j=0;j
And remove the line
delete ar;
since it does not have any effect after the return
statement. Additionally you can get rid of the instantiation
int *p=new int[count];
in main()
since this is done in your fib
function also. As it stands, you leak the memory you just allocated.