P
PraZ
Hi all.
Here is a simple code, which when compiled with gcc results in the
warning "incompatible pointer type" for arg 1, as expected. But this is
just what I want to do, because it makes it easy for me to handle the
single dimensional stream I have as a multidimensional array inside the
function func(). Now, I am just wondering if there is a way by which I
can disable this incompatible pointer type warning in gcc. Any
suggestions?
Best regards,
Prasanna.
/*The Code*/
#include <stdio.h>
void func(char [2][2]);
int main()
{
char* src;
int i;
src = (char*)malloc(16);
for (i=0; i<16; i++)
src = i;
func(src+4);
return 1;
}
void func(char src[2][2])
{
int r, c;
for (r = 0; r < 2; r++)
{
for (c = 0; c < 2; c++)
{
printf("%d, ", src[r][c]);
}
printf("\n");
}
}
Here is a simple code, which when compiled with gcc results in the
warning "incompatible pointer type" for arg 1, as expected. But this is
just what I want to do, because it makes it easy for me to handle the
single dimensional stream I have as a multidimensional array inside the
function func(). Now, I am just wondering if there is a way by which I
can disable this incompatible pointer type warning in gcc. Any
suggestions?
Best regards,
Prasanna.
/*The Code*/
#include <stdio.h>
void func(char [2][2]);
int main()
{
char* src;
int i;
src = (char*)malloc(16);
for (i=0; i<16; i++)
src = i;
func(src+4);
return 1;
}
void func(char src[2][2])
{
int r, c;
for (r = 0; r < 2; r++)
{
for (c = 0; c < 2; c++)
{
printf("%d, ", src[r][c]);
}
printf("\n");
}
}