H
herrcho
#include <stdio.h>
int main()
{
char *name[5];
int i;
name[0] = "Jung Jae Une";
name[1] = "Han Woo Ryong";
name[2] = "Byun Ji Ha";
name[3] = "Lee Do Geun";
name[4] = "Hong Jae Mok";
for (i=0;i<5 ;i++ )
{
puts(name);
}
for (i=0;i<5 ;i++ )
{
puts(name+i);
}
return 0;
}
i expected the two for statements result in same output.
but, the 'puts' statement in second one shows warning message
---> warning: passing arg 1 of `puts' from incompatible pointer type
and when i execute the file, the second one shows weird characters..
i don't know what is wrong..
int main()
{
char *name[5];
int i;
name[0] = "Jung Jae Une";
name[1] = "Han Woo Ryong";
name[2] = "Byun Ji Ha";
name[3] = "Lee Do Geun";
name[4] = "Hong Jae Mok";
for (i=0;i<5 ;i++ )
{
puts(name);
}
for (i=0;i<5 ;i++ )
{
puts(name+i);
}
return 0;
}
i expected the two for statements result in same output.
but, the 'puts' statement in second one shows warning message
---> warning: passing arg 1 of `puts' from incompatible pointer type
and when i execute the file, the second one shows weird characters..
i don't know what is wrong..