C: Passing integer by reference
main () { int COUNT_Struct_Rates, COUNT_Struct_Users; TXTDATA_Read_Rates(STREAM_Rates, COUNT_Struct_Rates); } int TXTDATA_Read_Rates(FILE *STREAM_Rates, int *COUNT_Struct_Rates) { ... } Upon compilation, I get the errors: assignment makes pointer from integer without a cast warning: return makes integer from pointer without a cast What am I doing wrong?
main () { int COUNT_Struct_Rates, COUNT_Struct_Users; TXTDATA_Read_Rates(STREAM_Rates, &COUNT_Struct_Rates); // modified } int TXTDATA_Read_Rates(FILE *STREAM_Rates, int *COUNT_Struct_Rates) { ... } and where is STREAM_Rates variable????
Sorry, I forgot to include it above. But assume that I declared it as FILE *STREAM_Rates;
main () { int COUNT_Struct_Rates, COUNT_Struct_Users; TXTDATA_Read_Rates(STREAM_Rates, &COUNT_Struct_Rates); // modified } int TXTDATA_Read_Rates(FILE *STREAM_Rates, int *COUNT_Struct_Rates) { ... } assuming the FILE* STREAM_Rates is declared inside main...not in global space...should be doing good
i think declaring int COUNT_Struct_Rates, and int *COUNT_Struct_Rates is wrong warning: return makes integer from pointer without a cast : check your return instruction and int TXTDATA_Read_Rates(FILE *STREAM_Rates, int *COUNT_Struct_Rates) from the name i think you're reading from a file so you can't use int for the function try void
Join our real-time social learning platform and learn together with your friends!