[Solved] GCC compiler errors with “No such file or directory”

please do the following. On terminal check the present directory by ‘pwd’ command and then check the directory in which your programme is there and see if they are same or not. And while writing gcc yourfile it’s case sensitive. Hope this helps 1 solved GCC compiler errors with “No such file or directory”

[Solved] garbage value in C array

In the function argument: char arr[9][5] In the loop: for (i = 0; i<5; i++) { for (j = 0; j<9;j++) { if (arr[i][j] == 1) You flipped the position of i and j. i should go from 0 to 9, j from 0 to 5. 0 solved garbage value in C array

[Solved] Confusing and unexpected behaviour of “if” statement in C [closed]

You didn’t copy the program correctly. This is the real program that reproduces the bug: #include <stdio.h> #define TRUE 1 #define FALSE 0 int function_returning_false() {return FALSE;} int main() { if (function_returning_false) { // note, no () printf(“function returned true\n”); } } So, it’s not calling the function – it is passing the function as … Read more

[Solved] some arm inline assembly [closed]

As mentioned by the commenters LDR r3,#0xaabbccdd is not a valid instruction. Immediates in ARM opcodes are on the form ZeroExtend(imm8) ROR (imm4*2), which would allow you to represent e.g. 0xaa000000, 0x00bb0000 and even 0xd000000d – but not e.g. 0xaabb0000 or 0xaabbccdd. Assemblers typically provide a pseudo-instruction for loading 32-bit immediates, e.g. in GAS you … Read more

[Solved] Unclear about return value of a void function in C [closed]

The result in this situation is based on whats on top of the stack when test() is returned. The behaviour is undefined. You should compile your code with warnings enabled: gcc main.c -Wall Also, altering your argv pointer is a bit dirty. De-referencing argv directly communicates your intentions in a clear way: printf(“\n%d\n”, test(atoi(*++argv), 2)); … Read more

[Solved] Making a new function by fixing one of the input parameters [closed]

You probably want lambda or std::function, or std::bind auto l_add_100 = [](double x) { return add_two_numbers(x, 100); }; std::function<double(double)> f_add_100 = [](double x) { return add_two_numbers(x, 100); } auto b_add_100 = std::bind(add_two_numbers, std::place_holder::_1, 100); or with non hard coded number double y = //… auto l_add_y = [y](double x) { return add_two_numbers(x, y); } std::function<double(double)> … Read more

[Solved] How does GCC store member functions in memory?

For the purpose of in-memory data representation, a C++ class can have either plain or static member functions, or virtual member functions (including some virtualdestructor, if any). Plain or static member functions do not take any space in data memory, but of course their compiled code take some resource, e.g. as binary code in the … Read more

[Solved] Why is this code not taking input for “Designation”?

When reading from standard input, do not mix C library functions, such as fgets(), and C++ std::cin operators. The C library knows nothing about what the C++ library is doing. Change your code to use only stdin, or only std::cin, to read standard input. solved Why is this code not taking input for “Designation”?