First off, let me say hi to everybody here. I am trying to learn C but I am finding it a little cryptic compared to java.
anwyay, I am getting an error saying warning: assignment makes integer from pointer without a cast
on this line: buff = gets(character);
and heres the code:
Code:
#include <stdio.h>
int main( int argc, char * argv[] ){
int i, j = 0;
char buff, p[2];
char character[256] = {0};
if( pipe(p)==-1 ){
printf("pipe failed");
exit(-1);
}
printf("Enter two chars to compare: ");
for(i; i<2; i++) {
switch( fork() ){
case 0:
buff = gets(character);
printf("PID of child %d is %d\n", j+1, getpid() );
write( p[1], &buff, sizeof(char) );
return 0;
break;
case -1:
printf("A forking error has occurred\n");
exit(-1);
break;
default:
break;
}
}
}
Any idea what I am doing wrong?