Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

C: Passing integer by reference

OpenStudy (anonymous):

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?

OpenStudy (arnavguddu):

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????

OpenStudy (anonymous):

Sorry, I forgot to include it above. But assume that I declared it as FILE *STREAM_Rates;

OpenStudy (arnavguddu):

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

OpenStudy (anonymous):

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

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!