What is signed integer overflow?

Your while condition will always be true, meaning the loop will run forever, adding 1 to c in each iteration. Since c is a (signed) int it means it will increment slowly to its max value, and after that the next increment would be UB (undefined behavior). What many machines will do in this specific UB is to turn c negative, which I … Read more

How can one see content of stack with GDB?

info frame to show the stack frame info To read the memory at given addresses you should take a look at x x/x $esp for hex x/d $esp for signed x/u $esp for unsigned etc. x uses the format syntax, you could also take a look at the current instruction via x/i $eip etc.

Implementation of multiple pipes in C

I believe the issue here is that your waiting and closing inside the same loop that’s creating children. On the first iteration, the child will exec (which will destroy the child program, overwriting it with your first command) and then the parent closes all of its file descriptors and waits for the child to finish … Read more

Undefined reference to main – collect2: ld returned 1 exit status

It means that es3.c does not define a main function, and you are attempting to create an executable out of it. An executable needs to have an entry point, thereby the linker complains. To compile only to an object file, use the -c option: The above compiles es3.c to an object file, then compiles a file main.c that would contain the main function, and the linker merges es3.o and main.o into … Read more

What is the difference between array and enum in C ?

Array is a variable that can contain multiple elements with index starting from 0 whereas enum is an user defined datatype that contains a list of members for which an integer constant is assigned starting from 0. in case of enum the numbers starting from 0 are not indexes whereas in case of an array they are indexes. … Read more

Difference between pic Vs pie

From the gcc documentation: -fpicGenerate position-independent code (PIC) suitable for use in a shared library… -fpieThese options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables….

Assembly x86 – “leave” Instruction

LEAVE is the counterpart to ENTER. The ENTER instruction sets up a stack frame by first pushing EBP onto the stack and then copies ESP into EBP, so LEAVE has to do the opposite, i.e. copy EBP to ESP and then restore the old EBP from the stack. See the section named PROCEDURE CALLS FOR BLOCK-STRUCTURED LANGUAGES in Intel’s Software Developer’s Manual Vol 1 if you want to read more about how ENTER and LEAVE work. enter n,0 is exactly equivalent … Read more

How to empty a char array?

using in general if the array is in scope, or if you only have the pointer value, and nMembers is the number of elements in the array. EDIT Of course, now the requirement has changed from the generic task of clearing an array to purely resetting a string, memset is overkill and just zeroing the first element … Read more

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