r/C_Programming • • 9h ago

How can I pass c exam

0 Upvotes

I have a c exam tomorrow, I failed my internal exams, ik what im doin is dumb . Exam is on 50 and I need 15 to pass but I don’t know how to write programs, can I pass by studying theory


r/C_Programming • • 23m ago

阅读《用C语言编写一个Shell》(lsh)让我深入思考:老一辈UNIX开发者是如何从零开始设计Shell的?

0 Upvotes

嘿,大家好,

我目前正在阅读斯蒂芬·布伦南的经典教程《用C语言编写一个Shell》(`lsh`),进展到一半。到目前为止,这本书读起来很有趣,但感觉有点空洞——它展示了如何将 `fork()`、 `exec()`和 `wait()` 结合在一起,却让我渴望看到真正的官方规格和更深入的设计文档。

这让我想到两件事:

首先,像肯·汤普逊或斯蒂芬·伯恩这样的老前辈是如何在一张白纸上构建早期UNIX shell的?我想要阅读真正的基础论文、POSIX文档或历史设计分析,而不仅仅是玩具教程。

其次——将经典的 `Read -> Parse -> Execute` 循环与现代AI代理相结合——这种方式与代理如何解析上下文和分发工具非常相似。

寻找关于历史规格、论文或最小化shell源代码库的推荐。请在下面留言!


r/C_Programming • • 6h ago

Question 2. Write a program to print integer number and input from user

0 Upvotes

#include<stdio.h>

void main()

{ int a; // a is variable and this data type is integer
printf("Enter your value : "); // printf is use for print value
scanf("%d",&a); //scanf  is use input from user
printf("Your Value is : %d", a);

}


r/C_Programming • • 1h ago

Question Library API Naming Conventions

3 Upvotes

Hi Everyone,

I'm working on a small 2D game library/runner. At the moment it's for personal use but I may release it some day, which is why I'm creating this post!

At the moment, the function names in the library are named like this (the name of the library is Imp):

imp_texture_create(...)
imp_texture_destroy(...)
imp_camera_set_position(...)
imp_camera_set_rotation(...)

I quite like this naming convention, mainly because if I wanted to see what functions were available for a given resource or operation, I could type imp_camera_ and then my editor would show a list of things that I can do with, or to, a camera. I also used GameMaker a lot when I was younger, and this is the way their API names functions!

Recently though, I've been using a lot of Raylib and quite like the way it names its functions - they are, to me at least, a lot more readable when looking through code. This has me thinking whether or not a better naming convention would be:

imp_create_texture(...)
imp_destroy_texture(...)
imp_set_camera_position(...)
imp_set_camera_rotation(...)

The downside being that you sort of have to guess what operations are available for a given resource as you can no longer type imp_texture_ to have the editor show a list.

I understand that this is a really small issue and probably not really worth fussing about, but I was curious what preferences more experienced people here have and - more importantly - why you have them!