#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
FILE* fp1; //correct data type used , FILE1,FILE2 are noot correct
FILE* fp2;
char pentominoes1[4] = {'N', 'H', 'D', 'D'};
char pentominoes2[3] = {'D', 'D', 'G'};
char ch;
/* well is 12 * 10 rectangle */
/*3 fields are separated by white spaces */
// pentominoes1[4][4] = { // These Lines are commented
// {0, 1, 2, 0}; // because
// {0, 6, 5, 8}; // already variables ----> pentominoes1
// }; // &
// pentominoes2[3][3] = { // ----->pentominoes2
// {1, 1, 2}; // are defined & declared on
// {0, 6, 4}; // Line# 8,9
// }; // Coorect the names or fix ur logic :)
/* read input files */
fp1 = fopen("input1.txt", "r");
fp2 = fopen("input2.txt", "r");
if (NULL == fp1 && NULL == fp2){
printf("file cannnot be opened \n");
}
do{
int x= fgetc(fp1); // added missing variables x & y
int y= fgetc(fp2); //
printf("%c", ch);
}while (ch != EOF);
fclose(fp1);
fclose(fp2);
return 0;
}
/* Functions */
void empty_field()
{
int i;
int pentomino_squares = 5;
char pentomino_occupied;
for(int i = 0; i > 5; i++)
{
pentomino_squares - 1; /* pentomino falls straight down the well one square at a time */
//original code below
// if(pentomino_occupied == "True") /* A pentomino cannot fall into a square that is already occupied by previously fallen pentomino */
if(pentomino_occupied == 'y') /* pentomino_occupied is char , cant compare with "true",which is string [literal] ,*/
{
pentomino_squares += 1;
pentomino_squares - 1;
}
}
}
void rotations()
{
int rotation = 0;
int position = 0;
for(int i = 0; i > 5; i++)
{
for(int i = 0; i > 4; i++)
{
rotation+=1;
position +=1;
for(int i = 0; i > 3; i++)
{
rotation+=1;
position+=1;
}
}
}
}
void position()
{
int position = 0;
}
void pentomino()
{
char column = 0; // replaced j with 0... from where does j come here .... ??
char bottom_block;
int square = 0;
int top_block = 0;
int leftmost_squares = 0;
if(square == top_block)
{
leftmost_squares = column;
bottom_block = top_block;
}
}
Above code compiles without error
The logic you are trying to implement is very unclear, all the best with fixing logical errors.
I have added comments where changes are done