How to concatenate string and int in C?

Strings are hard work in C. The 12 is enough bytes to store the text “pre_”, the text “_suff”, a string of up to two characters (“99”) and the NULL terminator that goes on the end of C string buffers. This will tell you how to use snprintf, but I suggest a good C book!

Undefined reference maybe makefile is wrong?

The errors that you’re getting are linker errors, telling you that while linking your program the linker can’t find a function named ‘CreateSet’ (etc.). It’s not immediately obvious why that should be the case, because it appears that you’re including “set.o” in the build command. To troubleshoot build problems, it’s often useful to figure out … Read more

typedef struct pointer definition

You cannot use pEDGE within the definition of the struct. You shoud do something like: You must also note that edge_item is a double pointer. You also mention that in your question. So if you use pEDGE_ITEM and you just want to have a normal pointer you should not write pEDGE_ITEM *edge_item but just pEDGE_ITEM … Read more

What is `S_ISREG()`, and what does it do?

S_ISREG() is a macro used to interpret the values in a stat-struct, as returned from the system call stat(). It evaluates to true if the argument(The st_mode member in struct stat) is a regular file. See man stat, man fstat or man inode (link to inode man page) for further details. Here’s the relevant part … Read more

Warning: X may be used uninitialized in this function

one has not been assigned so points to an unpredictable location. You should either place it on the stack: or dynamically allocate memory for it: Note the use of free in this case. In general, you’ll need exactly one call to free for each call made to malloc

Source file not compiled Dev C++

I just installed Dev C++ and I am learning C programming. the code i used was I saved it as a .c file. When I compile it works fine, but when I compile and run it says source file not compiled. So I googled buncha things and came across this video on youtube which shows … Read more

How do you implement a class in C?

That depends on the exact “object-oriented” feature-set you want to have. If you need stuff like overloading and/or virtual methods, you probably need to include function pointers in structures: This would let you implement a class, by “inheriting” the base class, and implementing a suitable function: This of course requires you to also implement a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)