|
-
May 6th, 2003, 07:09 AM
#1
Pointer to array
Hi,
In the below program, while compiling I getting a warning
" warning C4047: '=' : 'int (*)[10]' differs in levels of indirection from 'int *' ". But it works as expected. Also I dont want to change the declaration "pointer to array". How can I eliminate this? Please any one help.
#include <stdio.h>
main()
{
int (*n)[10];
int i,ii;
n=(int *)malloc(sizeof(int)*1024);
for(i=0;i<10;i++)
{
for(ii=0;ii<10;ii++)
{
n[i][ii]=ii+i;
}
}
for(i=0;i<10;i++)
{
for(ii=0;ii<10;ii++)
{
printf("%d\n",n[i][ii]);
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|