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

i don't understand the syntax ((typedef *) address value)

hi Everybody,
i copy and paste a line of code bellow as an example:

"#define USB (( USB_TypeDef *) USB_BASE)"

( suppose #define USB_BASE 0x0C000 )

i don't understand the "(( USB_TypeDef *) USB_BASE)"?
why the *, the pointer operator, is placed with type inside parenthesis?

thanks,
Ras

Parents
  • Per Westermark!

    thank you very much.

    " The first is a type cast - telling the compiler to treat an integer as a pointer to a sepcific data type.

    The second is a variable declaration. Telling the compiler to allocate the memory for a single variable USB_BASE that is of type "Pointer to USB_TypeDef"."

    these solved my problem; type casting.

    ( i am learning c programming language within my embedded projects. )

    with the best regards,

    Rasool

Reply
  • Per Westermark!

    thank you very much.

    " The first is a type cast - telling the compiler to treat an integer as a pointer to a sepcific data type.

    The second is a variable declaration. Telling the compiler to allocate the memory for a single variable USB_BASE that is of type "Pointer to USB_TypeDef"."

    these solved my problem; type casting.

    ( i am learning c programming language within my embedded projects. )

    with the best regards,

    Rasool

Children
No data