I had made an error in my code at one point when I forgot to end a variable initialization with a semicolon and instead had put a comma. However, to my surprise it never returned an error and the code worked like normal.
Therefore I was wondering how this works ? I simplified my code by writing the below code;
uint32_t randomfunction_wret()
{
printf("(%d:%s) - \n", __LINE__, __FILE__);
return 6;
}
uint32_t randomfunction()
{
printf("(%d:%s) - \n", __LINE__, __FILE__);
}
int main()
{
uint32_t val32 = 3, randomfunction_wret(), valx = 6, randomfunction();
printf("(%d:%s) - %u %u\n", __LINE__, __FILE__, val32, valx);
return 0;
}
When executed is returns;
(43:test.c) - 3 6
I am very shocked that there is no error when I have functions separated in my initialization. However the functions were not even being called.
============== UPDATED
How about if the code was as follows, from what I see, now each function is called;
int main()
{
uint32_t val32;
val32 = 3, randomfunction_wret(), randomfunction();
printf("(%d:%s) - %u \n", __LINE__, __FILE__, val32);
return 0;
}
Output would be
(23:test.c) -
(29:test.c) -
(38:test.c) - 3