Skip to main content

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.

-2 votes
2 answers
40 views

uint8_t elements exceeding one byte?

I saw this code: uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; I know uint8_t holds a byte, so how does this line of code work when a single element, 0xFF, is in itself one whole ...
bittybytey's user avatar
-4 votes
0 answers
26 views

How do i interact with an image in C [closed]

Ok so i wanted to write a program that could take an image check each individual pixel's color in a frame and assign it a greyscale number just by dividing the RGB value by 3. the problem is that i ...
typhrenn's user avatar
1 vote
2 answers
47 views

Any one know how return 0 works or maybe any problem with devc++

im new at coding. so right now im learning C and im using devc++. but i don't know my program instantly close after i compile #include <stdio.h> int main() { printf("hello"); ...
Hansen Gregorius's user avatar
2 votes
0 answers
22 views

How to take screenshot in gtk4?

I am trying to take a screenshot of the root window in gtk4. This is how I do it in gtk3-- GdkWindow *root_win = gdk_get_default_root_window(); gint width = gdk_window_get_width(root_win); gint ...
dibyendu's user avatar
  • 135
1 vote
1 answer
43 views

Linking header file still leads to undefined reference

I have three files: vector2d.h referencing my functions. vector2d.c defining my functions. test_vectors.c as the main file. test_vectors.c doesn't build because it returns an undefined reference error ...
sidvworld's user avatar
0 votes
0 answers
43 views

Dev C++ strcmp in C returns -1 instead of 1 [closed]

The code: #include <stdlib.h> #include <stdio.h> #include <string.h> int main(){ int result; char can[15];"a"; char canan[15];"A"; ...
Othin's user avatar
  • 9
0 votes
0 answers
29 views

Use C socketpair [closed]

I try to write test for a function which reads from socket, preferably using one process. To simulate a sender, I plan to use socketpair, but the following code does not work. #include <stdio.h> ...
user180574's user avatar
  • 5,972
2 votes
3 answers
95 views

Converting to char*** from char* [2][2]

I have the following variable char* a[2][2] = {{"123", "456"}, {"234", "567"}}; I wanted to refer it using another variable. While the cast works, accessing ...
5reep4thy's user avatar
-2 votes
0 answers
55 views

Shift Scheduling using Hungarian Algorithm

Question: A retail store needs to schedule shifts for its employees over a week. Each employee has different skills and preferences, and each shift requires specific skills. The goal is to minimize ...
zGrish's user avatar
  • 11
0 votes
1 answer
100 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='...
Rajesh Paul's user avatar
0 votes
0 answers
72 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 ...
nowox's user avatar
  • 28k
1 vote
1 answer
15 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 = ...
The goose's user avatar
2 votes
1 answer
91 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 &...
k1r1t0's user avatar
  • 735
0 votes
1 answer
72 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" ...
Иванов Леонид's user avatar
1 vote
0 answers
20 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 ...
Aiman's user avatar
  • 31

15 30 50 per page
1
2 3 4 5
27031