#31 expression must have integral type

I’m having some problems with my C code and get the error in the title. First off, Uint16 is defined as: I use two variables in the function where I get the error, they are defined as: I call the function like this: and the function definition is like this: and lastly, the declaration in … Read more

C: linker command failed with exit code 1

You have the following line of code: Inside the main function. There are 2 major problems with this. Function declarations cannot appear inside of another function. The line I quoted needs to appear outside of your main function as follows:int lookup(…..) //code here int main(…) { //more code here } Even though you declare the … Read more

lvalue required as left operand of assignment

You need to compare, not assign: Because you want to check if the result of strcmp(“hello”, “hello”) equals to 0. About the error: lvalue required as left operand of assignment lvalue means an assignable value (variable), and in assignment the left value to the = has to be lvalue (pretty clear). Both function results and constants are not assignable (rvalues), so they are rvalues. … Read more

Reading \r (carriage return) vs \n (newline) from console with getc?

\n is the newline character, while \r is the carriage return. They differ in what uses them. Windows uses \r\n to signify the enter key was pressed, while Linux and Unix use \n to signify that the enter key was pressed. Thus, I’d always use \n because it’s used by all; and if (x == ‘\n’) is the proper way to test character equality.

Converting a C program to MIPS

Currently you’re generating code for x86-64 – you need to select a MIPS compiler from the popup menu above the assembly pane: After you’ve done that you’ll probably see generated code like this: Note that the compiler has optimised away some of the redundant operations in the original C code. If you want to see an … Read more

Does connect() block for TCP socket?

There’s hardly any “immediately” regarding networking, stuff can be lost on the way, and an operation that should be performed immediately in theory might not do so in practice, and in any case there’s the end to end transmission time. However connect() on a TCP socket is a blocking operation unless the socket descriptor is … Read more