The question more conceptual type it works but the result is not what i expect
shouldn't the output be the input that was of first loop because file is closed after that for example output should be(0,1,2,3,4,5........) but it's (0,0,0....)
Line 10 writes only the first element of the array to the file, and line 17 reads only one element into the array. That element happens to be the first, which is 0 in both cases. You'll want a loop to read/write if you want to read/write the whole array.
Can you tell me by giving a code snippet sorry i understood your concept but it's implementation didn't work although my problem is solved now(thanks to your hint) by changing sizeof(int) to max*sizeof(int) in both lines so thank you :)