Why is the output 321 instead of 212?

#include <stdio.h> int main() { int i; int j; int k; for(i = 1, j = 0, k = 3 ; i <= 5, j <= 6, k > 1 ;i++, j++, k–); { printf("%d%d%d", i, j, k); } } Why is this program printing 321 instead of 212? I get 321 when I execute… Read More Why is the output 321 instead of 212?

How is it possible to save two data in the same memory location on C?

I’m learning C language, specifically pointers and I have this little question. How is it possible to save two data in the same memory location on C? Look my code: #include <stdio.h> int main() { const int y = 2; int *const ptr_y = &y; *ptr_y = 4; //Values printf("%d\n", y); printf("%d\n\n", *ptr_y); //Memory locations… Read More How is it possible to save two data in the same memory location on C?

How can I get arguments from standard input in C?

I have a string that I want to execute in C file and I’d like to get the string from standard input. echo "Here is some random text.\n" | ./main.c >Solution : Read from stdin like any other FILE stream. #include<stdio.h> int main() { char line[BUFSIZ]; fgets(line, sizeof(line), stdin); printf("stdin: %s", line); }

C language: main .obj file (and executable) is nearly 400MB in size

Dependencies: GLFW 3.3.7 GLAD 4.0 core CGLM 0.8.5 stb_image 2.2.7 Compiler: GCC 11.2.0 (MinGW-W64) CMake 3.23.1 GNU Make 4.3 Problem The .obj file for main.c (and executable) is nearly 400MB in size Generated .obj files: https://i.stack.imgur.com/Dgn51.png There must something wrong with the main.c file and/or the way I include my dependency headers, but I can’t… Read More C language: main .obj file (and executable) is nearly 400MB in size