Function main is special - it is the only (*) C function whose interface (that is, its function prototype) is specified in the C Standard. You can't change it. Your definition here for main is not compatible with the C Standard. You should change the name of your function (I'll call it Saras015). You will still need a legal main function, but I suggest you use it to call Saras015.
Try this...
Code:
#include <stdio.h>
void Saras015(int *val);
int main(void) {
int mainVal;
mainVal = 100;
printf("%d\n", mainVal);
Saras015(&mainVal);
printf("%d\n", mainVal);
Saras015(&mainVal);
printf("%d\n", mainVal);
return 0;
}
void Saras015(int *val) {
[I]Same as you had before[/I]
}
Run this and see what hints it gives you regarding what Saras015 is doing.
Last edited by donbock; Mar 31 '17, 01:46 PM.
Reason: (*) ok, the C Standard also specifies the interfaces for the Standard Library functions; but you have the option to redefine those interfaces and write your own library functions. Bad idea!
Comment