#include int* fib(int); int main() { int count; std::cout<<\"enter number up to which fibonacci series is to be printed\"<
One problem is that you allocate the array one element too short. The parameter in new[] is the number of elements, not the highest index.
new[]
Another problem is that you allocate the array in two places, but that only creates a memory leak and doesn't affect the result.