Relative Content

Tag Archive for cfile-ioincrement

C increment ++ unexpected result

I have a problem with using increment ++ while trying to increase the value of an int variable. I’m passing the address of the variable called records to the function open() than opens a file in binary mode and then parses the file to find the amount of struct record elements present in the file. The problem is that when using the increment ++ as *records++; the result is not what expected, for example I have 4 records in the .dat file and it prints: