It's not clear to me exactly what you want to accomplish, but how about something along these lines?
Code:
int values[] = { 10, 20, 30, 40 }, i;
for (i = 0; i < 4; i++) {
x == values[i] ? assign; break : continue;
}
This loop is totally wacky looking:
Code:
pos = 1;
while ((c = fgetc(f)) != EOF) {
fseek(f, pos - 2, SEEK_CUR);
fscanf(f, "%s %lf", temp_title, &temp_price);
insert(titles, prices, temp_title, temp_price);
}
What is it you are actually trying to do here? What's the point of "c"? It looks like you are just checking to see if you can read then rewinding. Zany. Not a good method. Forget the fgetc() and just make the condition:
Code:
while (fscanf(f, "%s %lf", temp_title, &temp_price) == 2) {
That may need some tweaking depending on how consistently the file is structured.