This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

8051

I run the following program in keil software....it shows printf ANSI-style prototype error....
please give a clue for correcting the error...

#include "Main.h"
#include "show.h"
#include "PRINTF51.c"
void sho_inti(void)
{ int (*fnptr)();
fnptr=show;
printf("Address of function:%u",&show);
(*fnptr)();
} void show(void)
{ printf("\n function called using pointer");
}

Parents
  • "I run the following program in keil software"

    That is not a program - that is just a snippet of source code.

    You didn't even bother to follow the instructions on how to post source code: www.danlhenry.com/.../keil_code.png

    "it shows printf ANSI-style prototype error"

    So fix the error in your ANSI-style prototype!

    You haven't included the standard header file that would give the correct prototype for printf, so presumably it must be in one of those other files that you've #included?

    As we don't have access to those files, how do you expect us to be able to comment on them?

    #include "PRINTF51.c"
    

    Why are you #including a .c file??

Reply
  • "I run the following program in keil software"

    That is not a program - that is just a snippet of source code.

    You didn't even bother to follow the instructions on how to post source code: www.danlhenry.com/.../keil_code.png

    "it shows printf ANSI-style prototype error"

    So fix the error in your ANSI-style prototype!

    You haven't included the standard header file that would give the correct prototype for printf, so presumably it must be in one of those other files that you've #included?

    As we don't have access to those files, how do you expect us to be able to comment on them?

    #include "PRINTF51.c"
    

    Why are you #including a .c file??

Children
No data