Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc, char *argv[]){
- char puzzle[101];
- int size;
- FILE *fp = fopen(argv[2], "r");
- if(fp == NULL){
- printf("Error, file does not exist\n");
- return 1;
- }
- fscanf(fp, "%s", puzzle);
- sscanf(argv[1], "%d", &size);
- char word;
- int **array, a;
- array = malloc(sizeof(int*) * size);
- for(a=0; a<size; a++){
- array[a] = malloc(sizeof(int) * size);
- while(strcmp(word, "zzz") != 0){
- buildPuzzle(array, size, size);
- printf("The word puzzle is:\n%s\n", word);
- printf("Enter a word to find in the puzzle: ");
- }
- fclose(fp);
- return 0;
- }
- void buildPuzzle(int **data, int row, int col){
- int a, b;
- for(a=0; a<row; a++){
- for(b=0; b<col; b++){
- data[a][b] = size;
- }
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement