Search:
Forum
General C++ Programming
problem in displaying array elements
problem in displaying array elements
Oct 21, 2010 at 2:50pm UTC
saikumar029
(8)
#include<stdio.h>
#include<conio.h>
int *fun()
{
int i[]={1,2,3,4,5};
return &i[0];
}
void main()
{
int *p;
int i;
clrscr();
p=fun();
for(i=0;i<5;i++)
{
printf("%d\n",*(p+i)); // problem in displaying array elements
}
getch();
}
Last edited on
Oct 21, 2010 at 3:03pm UTC
Oct 21, 2010 at 3:51pm UTC
Bazzy
(6281)
http://www.cplusplus.com/articles/how_to_ask/
Oct 21, 2010 at 7:03pm UTC
saikumar029
(8)
buzzy i think you d't know how to solve it
anyway
i came to know that i as to declare an array as static/ global
Last edited on
Oct 21, 2010 at 7:03pm UTC
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs