try this
#include<stdio.h>
void main()
{
int n[3][3]= {
2,4,3,
6,8,5,
3,5,1
};
int i,*ptr;
ptr= (int *) n;
for(i=0;i<=8;i++)
printf("\n%d",*(ptr+i));
}
On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty <[email protected]>wrote:
> #include<stdio.h>
>
> void main()
> {
> int n[3][3]= {
> 2,4,3,
> 6,8,5,
> 3,5,1
> };
> int i,*ptr;
> ptr= n;
> for(i=0;i<=8;i++)
> printf("\n%d",*(ptr+i));
>
> }
>
> In gcc 4.3.2 no error ,it is just showing a warning as
>
> ms50.c: In function ‘main’:
> ms50.c:11:8: warning: assignment from incompatible pointer type
>
> change the statement as ptr = n[0] warning vanishes
>
> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam <[email protected]> wrote:
>
>> what's the problem with line number 12?
>>
>> 1 #include<stdio.h>
>> 2 #include<conio.h>
>> 3 void main()
>> 4 {
>> 5 clrscr();
>> 6 int n[3][3]= {
>> 7 2,4,3,
>> 8 6,8,5,
>> 9 3,5,1
>> 10 };
>> 11 int i,*ptr;
>> 12 ptr=n;
>> 13 for(i=0;i<=8;i++)
>> 14 printf("\n%d",*(ptr+i));
>> 15 getch();
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Rajeev N B <http://www.opensourcemania.co.cc>
>
> "*Winners Don't do Different things , they do things Differently"*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.