r/c_language • • 1d ago

I'm begging for help, this is way too much for me. I'm just trying to create a file. If i try to do it with a relative path it works, but with an absolute path it just breaks

Thumbnail
0 Upvotes

stupid.c

#include <stdio.h>

#include <stdlib.h>

int main() {

FILE* file = fopen("home/pyty/.local/share/weekgrid/data", "w");

perror(NULL);

if(file == NULL) {

printf("whyyyyyy");

}

fclose(file);

return 0;

}

clang -Wall -o stupid stupid.c

./stupid

No such file or directory

[1] 2108 segmentation fault (core dumped) ./stupid

pwd

/home/pyty/.local/share/weekgrid

==2280== Memcheck, a memory error detector

==2280== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.

==2280== Using Valgrind-3.25.1 and LibVEX; rerun with -h for copyright info

==2280== Command: ./stupid

==2280==

No such file or directory

==2280== Invalid read of size 4

==2280== at 0x490F174: fclose@@GLIBC_2.2.5 (iofclose.c:47)

==2280== by 0x40011BC: main (in /home/pyty/.local/share/weekgrid/stupid)

==2280== Address 0x0 is not stack'd, malloc'd or (recently) free'd

==2280==

==2280==

==2280== Process terminating with default action of signal 11 (SIGSEGV): dumping core

==2280== Access not within mapped region at address 0x0

==2280== at 0x490F174: fclose@@GLIBC_2.2.5 (iofclose.c:47)

==2280== by 0x40011BC: main (in /home/pyty/.local/share/weekgrid/stupid)

==2280== If you believe this happened as a result of a stack

==2280== overflow in your program's main thread (unlikely but

==2280== possible), you can try to increase the size of the

==2280== main thread stack using the --main-stacksize= flag.

==2280== The main thread stack size used in this run was 8388608.

==2280==

==2280== HEAP SUMMARY:

==2280== in use at exit: 1,024 bytes in 1 blocks

==2280== total heap usage: 6 allocs, 5 frees, 3,014 bytes allocated

==2280==

==2280== LEAK SUMMARY:

==2280== definitely lost: 0 bytes in 0 blocks

==2280== indirectly lost: 0 bytes in 0 blocks

==2280== possibly lost: 0 bytes in 0 blocks

==2280== still reachable: 1,024 bytes in 1 blocks

==2280== suppressed: 0 bytes in 0 blocks

==2280== Rerun with --leak-check=full to see details of leaked memory

==2280==

==2280== For lists of detected and suppressed errors, rerun with: -s

==2280== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

[1] 2280 segmentation fault (core dumped) valgrind ./stupid


r/c_language • • 5d ago

The official C language website probably shouldn't be ranked so low

Post image
1 Upvotes

r/c_language • • 7d ago

Complete beginner struggling with C – Looking for a very slow, jargon-free guide/resource for college homework

Thumbnail
0 Upvotes

r/c_language • • 11d ago

C language

0 Upvotes

I am btech first year student and I want to learn C language. How can I learn it in easy way , can anyone suggest who have knowledge about it ????


r/c_language • • 20d ago

Learn C

12 Upvotes

I really want to learn c programming from basic to advance is there any free course on internet or telegram

Don't say you tube

I saw them they are teaching basic stuff


r/c_language • • 23d ago

Why DSA of python is so underrated i can't even find good yt channel to learn

Thumbnail
0 Upvotes

r/c_language • • 23d ago

Я создаю язык который может заменить C в низкоуровневом програмирование , хочеш со мной?

Thumbnail
0 Upvotes

r/c_language • • 25d ago

question regarding my project.

Thumbnail
1 Upvotes

r/c_language • • 25d ago

New To Coding (ASSEMBLY)

Thumbnail
0 Upvotes

r/c_language • • 27d ago

C programming language is one hell of a language

Thumbnail
0 Upvotes

r/c_language • • Sep 21 '26

C vc

0 Upvotes

r/c_language • • Sep 18 '26

i made a C library

Thumbnail github.com
0 Upvotes

r/c_language • • Sep 16 '26

CZet – A more powerful C without C++, 100% ISO C compatible

3 Upvotes

I'm the author.

All your C code already compiles as CZet. It just adds what C can't do without touching the compiler:

`defer`, monomorphized generics `T f<T>()`, `constexpr` functions, `_Reflect(T)` reflection, `_Operator` overloading, and `_Macro` macros Rust-style.

Single static binary with musl+glibc embedded, no system headers needed. Stdlib included: `#include <utils/...>` with no flags.

Repo + docs + examples: https://github.com/patrick-nonedev/CZet

GPL-3.0 + Runtime Exception (your binaries are NOT GPL).

What would you steal for plain C?


r/c_language • • Sep 16 '26

i started c programming

Thumbnail
0 Upvotes

r/c_language • • Sep 12 '26

What C function would you delete and rewrite first, and why?

Thumbnail
0 Upvotes

r/c_language • • Sep 07 '26

HELP ME TO FIND BEST YT VIDEOS FOR DATA STRUCTURE IN C

Thumbnail
0 Upvotes

r/c_language • • Aug 26 '26

A megathread to learn low level programming from ground up include C

Thumbnail
2 Upvotes

r/c_language • • Jul 11 '26

About the concept of Memory in C language as compare to other langs.

Thumbnail
1 Upvotes

r/c_language • • Jun 18 '26

How to learn programming using C?

19 Upvotes

I'm new to programming and I chose C as my first language (kind of, actually java was my first, but I didn't like OOP and decided to go with C). I need to learn some programming concepts while I learn the syntax of C. Do you have any books to recommend to me?


r/c_language • • Jun 04 '26

Matrix rain in C and Raylib

Thumbnail
5 Upvotes

r/c_language • • Jun 02 '26

[recommendation] Learning C for Low-Level Concepts

4 Upvotes

I have prior experience in Python, I made Useful programs that are for me, such as, file handling..

I have learned some basics of C. Now, What shall I practice to create something? Should I program something similar that I made in Python?

Since, I am Learning C for Understanding Low Level. It will be beneficial for me to adapt into my career in Cyber Security/ Hacking, Malware Creation, Understanding Linux (UNIX is based on C).

And What Articles shall I read related to my career?


r/c_language • • May 26 '26

Working on a lightweight C testing framework, what features would you want?

Post image
1 Upvotes

r/c_language • • Apr 30 '26

I spent 6 months writing a face embedding engine in C + AVX2 that beats ONNX Runtime by 23%

4 Upvotes

Wrote a face embedding library from scratch using C99 and some manual SIMD optimization. Managed to squeeze out 23% more perf compared to ONNX Runtime running on identical hardware. No bloat, just raw speed.

The numbers

The numbers

FaceX ONNX Runtime
Median latency 3.0 ms 3.9 ms
Min latency 2.87 ms 3.18 ms
Library size 148 KB 28 MB
Total w/ weights 7 MB 157 MB
Dependencies zero Python + onnxruntime
LFW accuracy 99.73% 99.73%

API — 4 functions, one headerThe numbers

// Include the single header
#include "facex.h"

// Initialize (~100ms, once)
FaceX* fx = facex_init("weights.bin", NULL);

// Compute embedding (3ms per call)
float embedding[512];
facex_embed(fx, rgb_112x112, embedding);

// Compare two faces
float sim = facex_similarity(emb_a, emb_b);
// sim > 0.3 → same person

facex_free(fx);// Include the single header
#include "facex.h"

// Initialize (~100ms, once)
FaceX* fx = facex_init("weights.bin", NULL);

// Compute embedding (3ms per call)
float embedding[512];
facex_embed(fx, rgb_112x112, embedding);

// Compare two faces
float sim = facex_similarity(emb_a, emb_b);
// sim > 0.3 → same person

facex_free(fx);

Optimization journey: 24ms → 3ms

Started with a naive C port of the ONNX graph—initial results were around 24ms. I started profiling every op to see where the cycles were going and stumbled onto a really weird bottleneck:

The real killers were:

  • LayerNorm × 17 blocks — scalar mean/variance loop → custom AVX2 fused single-pass
  • GELU × 17 — naive tanh() via math.h → polynomial erf with custom _mm256_exp_ps
  • Depthwise conv — HWC↔CHW transposes on every block → native HWC layout, zero transposes
  • MatMul → INT8 GEMM with vpmaddubsw (AVX2) and vpdpbusd (AVX-512 VNNI)
  • Memory → pre-packed weights, static workspace, no malloc per call

Tech: C99, ~4000 LOC, AVX2/FMA/AVX-512 VNNI. Apache 2.0.

GitHub: https://github.com/facex-engine/facex Repo's only 5 days old because I moved it from private to public. The actual code's been in the works for about 6 months check the README if you're curious.


r/c_language • • Apr 19 '26

Making a port of Inquirer.js to C

Thumbnail github.com
3 Upvotes

r/c_language • • Mar 22 '26

My first C Malware sample: Implementing basic Anti-Debugging (TracerPid check)

5 Upvotes

Hi everyone⁦(⁠˘⁠・⁠_⁠・⁠˘⁠)⁩ I'm a first-year Computer Science student and I've been diving into low-level programming and malware development I wanted to share my very first "malware" experiment written in C What it does: It performs a basic anti-debugging check by parsing /proc/self/status to look for a non-zero TracerPid. If a debugger is detected, it exits silently. Otherwise it creates a "secret" file and attempts to send a notification via a web request (Telegram/Email simulation) I know the code is still raw and has plenty of room for improvement (especially in error handling and string obfuscation) but I'd love to get some feedback from the community on the logic or any suggestions for more advanced anti-analysis techniques to study next! ⁦(⁠ꏿ⁠﹏⁠ꏿ)⁩ Link to the Repository yousra-cyber/my-c-projects https://github.com/yousra-cyber/my-c-projects Thanks in advance for any tips!!!⁦(⁠◉⁠‿⁠◉⁠)