Hello guys,
I'm now studying the pointers. There's a code I found in a book that worked on Netbeans ( using GCC compiler ) and didn't work on Microsoft VS 2010 express.
Code:
Code:
#include <stdio.h>
int main(void)
{
int s[5][2] = {
{ 1234, 56 },
{ 1212, 33 },
{ 1434, 80 },
{ 1312, 78 }
} ;
int ( *p )[2] ;
int i, j, *pint ;
for ( i = 0 ; i <= 3 ; i++ )
{
p = &s[i] ;
pint = p ;
printf ( "\n" ) ;
for ( j = 0 ; j <= 1 ; j++ )
printf ( "%d ", *( pint + j ) ) ;
}
return 0;
}
Why?
The error message ( MS VS ):
Code:
1>some_destination\main.cpp(16): error C2440: '=' : cannot convert from 'int (*)[2]' to 'int *'
Thanks in advance.