Your word comparison appears to be case insensitive.
What about your hash function? Is it case sensitive? ;-)
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)
What is happening there, is that you did your word count asuming that the next caracter would be alphabetical, here: al = isalpha(text[i + 1]);, but in this case, the next caracter are quotation marks so it's not counting a couple of words.
For starters, the first while statement isn't incrementing block_counter, so the code is just overwriting the first 512 bytes of block over and over until it only contains the last 512 bytes of the input file. Since there's no signature found ever, no output is generated.
There may be other issues, but this will get you back on track and give you the chance ...
You've got a few different problems. First, take a look at your first call to fopen(). You call it again to check if the result is NULL, but that's incorrect. Instead, try declaring a variable with the result of calling fopen():
FILE *ptr = fopen(dictionary, "r");
Then you can check with an if statement if ptr is equal to NULL.
As Cliff said ...
Let's talk about how you're using the hash function first. Here's your code:
Ignoring the missing semicolon, this is a normal function call. Since hash() returns an int, the code needs to do something with that int, like assigning it to an int var. Surely you know how to do that by now.
As for the hash function itself, it's using some ...
For grayscale you should take a look to operator precedence in C (google). The result 'a + b / c' is not the same than '(a + b) / c'
For reflect a question: How many swaps do you need to do to flip the image horizontaly? Think about it.
For blur you've found a way to go over the 3x3 pixels around the current pixel with your loops 'k' and 'l', and then ...
You need to read the report more carefully. Yes, 7 coins for $1.60 would be correct. But the problem is the return value that the program is sending.
The spec says to print the number of coins, not to return it when the program completes. The normal practice is that a program should return 0; when a program completes successfully, and to return a non-zero ...
The variables that you create in the for loops only exist within that for loop.
You can use the result of a certain iteration of a for loop by eg: including an if function within the for loop to pick up what you are after .
It's a scope problem: When you declare a variable inside a 'for' loop or a function, it only will be available until the loop/function ends. For example in your for loop: for(int i=0;text[i]!='\0';i++) as 'i' is declared and inicialized at the begining of the for loop, as soon as the loop finishes, it'll be destroyed and you won't be able to access to it ...
In the line changeOwed = changeOwed - biggestCoin;, you subtract a function from an integer. I assume you meant changeOwed = changeOwed - biggestCoin(changeOwed) instead, subtracting the return value of the function call instead.
After fixing that compiler error, what happens in your code if someone enters 0?
isdigit(k) is testing whether the ascii value of k is in the range of 48 - 57. Those are the ascii representations of '0' through '9'; here is an ascii table for your review. But k is an integer from this declaration int k = atoi(argv);, therefore isdigit(k) always returns 0.
Program should test that each character of argv is a "digit", ie argv[i]....