Questions tagged [c]
C is a general-purpose programming language used for system programming (OS and embedded), libraries, games, and cross-platform. This tag should be used with general questions concerning the C language, as defined in the ISO 9899 standard (the latest version, 9899:2018, unless otherwise specified — also tag version-specific requests with c89, c99, c11, etc.). C is distinct from C++, and it should not be combined with the C++ tag without a specific reason.
405,487
questions
0
votes
0
answers
42
views
Why does defining the elements of the array b is required to get the desired output
I recently learnt about typecasting pointers. So I played around, and made this bad code:
#include <stdio.h>
int main()
{
int* a;
char b[]= "Hye";
a = (int*)&b;
*a='...
0
votes
0
answers
58
views
C grammar BNF format? [closed]
I wanted to play around with the C grammar. I found somewhere this grammar below.
I seems it is not compatible with https://bnfplayground.pauliankline.com/ and I think the grammar provided is EBNF ...
1
vote
1
answer
13
views
CSFML Background not loading
I'm trying to learn how to use CSFML. And i created this basic window:
my_window_t *init_window(void)
{
my_window_t *temp = malloc(sizeof(my_window_t));
sfTexture *texture = ...
2
votes
1
answer
83
views
Is comparing two pointers to different char objects undefined in C?
This is code of memmove from https://github.com/gcc-mirror/gcc/blob/master/libgcc/memmove.c
void *
memmove (void *dest, const void *src, size_t len)
{
char *d = dest;
const char *s = src;
if (d &...
0
votes
1
answer
47
views
fflush(stdout) doesn't work on WSL Ubuntu
I'm writing simple Tetris game and this is function that prints out field with figures in one game tick. I call this proc in while-loop until the game ends and i want my program to "update" ...
0
votes
0
answers
16
views
Captures keep giving me the same value when enabling both channels of TIM4 in Input Capture Mode
Hardware:
Test bench that generates two PWM signals ( A and B )
Cable that connect the test bench to the other board
Other board that retrieves the PWM signals (Port D pin 12 and 13 ) and has to ...
0
votes
2
answers
47
views
Int32's from byte stream
I have a byte stream like
uint8_t buf[] = { 0xFF, 0x1B, … , 0x34 }; // approx. 800 Bytes
Now, I want to extract various ints from known positions and store them in their own variables, like "get ...
0
votes
0
answers
15
views
Servo motors do not rotate constantly unlike the original Arduino code intended to
I want to move servo motors for loop without stopping! What is wrong?
#include <Adafruit_PWMServoDriver.h>
#include <Wire.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
int ...
0
votes
0
answers
29
views
CSAPP 3e (global): Possible erratum for "Practice Problem 8.3" (p. 781)?
Due to the relative lack of popularity of CSAPP's global edition, I have been unable to figure out whether exercise problem 8.3 (partial screenshots shown above) is entirely correct. I have only found ...
-6
votes
2
answers
61
views
malloc(): corrupted top size on deleting an entry from binary file [closed]
I AM CREATING A SCHOOL MANAGEMENT SYSTEM . WHEN I TRY TO DELETE A STUDENT AFTER ADDING ONE I AM GETTING "malloc(): corrupted top size" ERROR .CANT FIND THE REASON.I AM A BEGINNER , HELP ...
1
vote
0
answers
22
views
"No include path in which to find stdio.h" error
I get this error when I try to run a C program:
E:\c_stuff>gcc frist_c.c -o frist_c
frist_c.c:1: No include path in which to find stdio.h
But I already did reinstall MinGW and added the C:\minGW\...
0
votes
0
answers
55
views
How can I have a better implementation of an unknown tree I wrote myself?
I am converting a X509 certificate management code from C++ to C, but C lacks many features that C++ has. So I wrote a data structure myself. Is there a similar data structure implemented in the ...
0
votes
1
answer
60
views
'gcc' command does not give any output
I have been trying to run a c code from my terminal. The command:
gcc abc.c
is not giving any output and instead it gives me a new command line without any messages.
When I try
python3 abc.py
the ...
1
vote
2
answers
60
views
Does including a header obviate the need for extern declarations?
On page 33 of K&R (The C Programming Language, 2e), they remark that
If the program is in several source files, and a variable is defined in file1 and used in file2 and
file3, then extern ...
0
votes
1
answer
53
views
Why is there random stuff in my string when printing its bytes?
I'm trying to see how format string bug works and tried to explore it by myself.
This is a simple program:
#include"stdio.h"
#include"string.h"
struct mystruct{
char buf[32];
...