Integer literal as parameters of function declaration in cpp

I’m almost familiar with c and c++ programming. Today I was searching about function declaration when I suddenly came across a strange syntax in c++ language. I wrote below code: #include <iostream> using namespace std; int foo(‘3′); int bar(3); int main(){ } I’ve never seen defining the literals as function parameters! So I expected to… Read More Integer literal as parameters of function declaration in cpp

C char* printf issue

I am facing a strange behavior with a char* variable user_message* parseMessage(char *incoming_msg, uint64_t size) { user_message* msg = calloc(1, sizeof(user_message)); printf("value: %s\n", incoming_msg); return msg; } void start_server() { char* msg = "1|david|pwd|"; printf("msg: %s\n", msg); parseMessage(&msg, 12); } The output : msg: 1|david|pwd| value: �[ I struggle to figure out what is wrong… Read More C char* printf issue