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 need to understand the basic codes mentioned below.

I am a student, currently involving in the project where I am developing the software for MCU board. For that I am referring some sample codes to understand the basic structure before I write my own code. I have come across-ed several misunderstood.. those are below

uint8_t uartOutput = 1  ;

uint8_t data;

static u8 r_count=0 ;  //here what is u8 , r_count is a variable, static is the system code

#define ELEM_SIZE(array)        (sizeof(array) / sizeof(array[0]))

#define SEND_CAN_MSG(can_id, msg)       send_can_msg(can_id, msg, ELEM_SIZE(msg))

#define LOG(Format, ...) uartOutput && Printf(formt,##__VA_ARGS_)

particularly, I want to know how these codes will work and need explanantion for for each word in each codes. because I am totally unfamiliar with these syntax. Especially, I want to know,, what it is (need explanation) ? and why it is necessary to use ??

Thank you very much for your time

Parents
  • Why do you jump directly for code that you may try to cut and paste into "your own" software?

    If you do it the way your teacher(s) planned it, you would first listen - and take notes - during class. And at home spend time reading the recommended literature. That should give you the basic knowledge about the C language. Enough knowledge so that you may write the required code yourself - without cutting/pasting someone else's code. But without knowledge so that you would understand code you happens to find and read.

    But the above is a plan where the teacher expects you to actually learn. You'll have to think about the advantages of actually learning and understanding and getting the most use of the lessons.

Reply
  • Why do you jump directly for code that you may try to cut and paste into "your own" software?

    If you do it the way your teacher(s) planned it, you would first listen - and take notes - during class. And at home spend time reading the recommended literature. That should give you the basic knowledge about the C language. Enough knowledge so that you may write the required code yourself - without cutting/pasting someone else's code. But without knowledge so that you would understand code you happens to find and read.

    But the above is a plan where the teacher expects you to actually learn. You'll have to think about the advantages of actually learning and understanding and getting the most use of the lessons.

Children