Category "c"

Generic function typedef in C - how to get rid of initialization warning?

I'm experimenting with generic-like code and I have a function like this (a lot of not relevant code removed): typedef uint8_t (*struct_converter_t)(void *, cha

How to use FT_RENDER_MODE_SDF in freetype?

I'm quite new to font rendering and I'm trying to generate signed distance field with freetype so that it can be used in fragment shader in OpenGL. Here is the

Compilation of nginx fails due to struct 'crypt_data' has no member named 'current_salt'

I am trying to compile nginx on Ubuntu machine with GCC. My Glibc version is 2.31. m@feynman:~/Junk/nginx-1.9.9 $ /lib/x86_64-linux-gnu/libc.so.6 --version GNU

Can I change the default linker script/flags of ld?

I am using a software, which modifies some bytes in an executable. I don't know what it does exactly, but I use it for license protection of the already built b

A question about returning local pointer variable in function

I know the variables in function are using stack space. When function exit, the space are freed. That's why we should declare the pointer variable as static in

is there a way to use fgets size dynamically

So im learning about pointers and dynamic memory and how am experimenting with fgets. So i want to take in a string input into a pointer using fgets, but i want

C program How to get return value from other function by using switch statement

So I am trying to do a program where it shows a menu and asks what will the user do. I am stuck in where I cant get the return value in case 1 and use it in cas

xv6 C skipping blank lines

I am trying to write a program in C (for xv6) that returns the last "n" number of lines of input text or a file (essentially tail) with the exception that it sh

How to change c syntax check standard in vscode

vscode default c syntax checker seems that c standard used not high (maybe c99 or lower) like the example following: array ellipsis is available in c11 , actua

CS50: Filter Edge Returns Mostly White Image

I have been stuck on CS50 Filter - Edges for a few days now, having a hard time determining what's wrong with my code. This code returns an almost all white ima

How to detect if a block of memory already freed

I already know that there is no way to know if a pointer target still a valid allocation of it's already freed, so I'm trying to use pointer to pointer to solve

Save page of WebKitWebView into file

I have this almost solved. I've found this function: void webkit_web_view_save_to_file (WebKitWebView *web_view, GFile *file,

Which all multicast groups are available under custom netlink protocol

I am trying to send a notification message from a kernel module to user space application using netlink sockets interface and custom netlink protocol. My unders

How to use dynamic 2d array inside a struct array in C?

What do I want to do? I'm working on a project on dynamic matrix multiplication. I want to input from the user that on how many matrices, he/she wants to perfor

cannot cast 'float64' to different essential type 'unsigned16' [MISRA 2012 Rule 10.8, required]

cannot cast 'float64' to different essential type 'unsigned16' [MISRA 2012 Rule 10.8, required] double x, y; #define MIN 2.0 uint16_t z = (uint16_t) ((x * MIN)

The pid works only once after the two calls to scanf

This program creates a pid and shares two integers (base and height) through the shared memory. The parent process time asks four times to insert two integers a

Faced an error: excess elements in char array initializer during print out of array of strings

I've tryed to print out some array of strings but faced error: excess elements in char array initializer Please make a hint what's worng with this code? Step 1

how can i pass string(taken as input from user) to a pointer function in c?

#include<stdio.h> void add(int a,int b) { int c=a+b; printf("\nSum=%d",c); } void hello(char *name) { printf("Hello %s",*name); } int main() {

Binary search program cause runtime error and failed hidden test cases

I am practicing binary search with problem 704 on leetcode. At first, I just follow the concept of binary search and came up with this solution: int search(int*

Different output on recursive call using static variable [closed]

int fun1(int x){ static int n; n = 0; if(x > 0){ n++; return fun1(x-1)+n; } return 0; } int fun(int x){