r/Cprog • u/malcolmi • Nov 09 '14
r/Cprog • u/FUZxxl • Sep 11 '15
Is it illegal to use the h or hh length modifiers when the corresponding argument to printf was not a short / char?
r/Cprog • u/werter806 • Sep 19 '18
I’m trying to make a program to switch letter cases, from lower case to upper case and vice versus, but I can’t get it to run through the first if statement, any help would be appreciated
r/Cprog • u/jackoalan • Feb 20 '15
Subtle effects of const?
Does anyone know of potential code differences when working with a const variable? By common knowledge, const adds a compile-time check to prevent value modification.
Are there any runtime effects? Like more comprehensive aliasing (knowing that the value won't change so keep it in a register longer). Perhaps something more subtle? Or no code differences at all?
r/Cprog • u/Rezanator3 • Apr 22 '18
C programming, getting the day from date. I’ve just started advanced data structures with nodes but I’ve got this assignment due tomorrow and I’m really confused how to go about this. I assume my lecturer wants us to use structures and arrays. Any help would be much appreciated
r/Cprog • u/nasciiboy • Sep 28 '16
this (regex) algorithm is new? & the source code is elegant?
This is the link to the regexp library code in c https://github.com/nasciiboy/RecursiveRegexpRaptor
there is a simpler method of resorver the problem?
any proposal to replace "denial of exprecion"?
the code is good|simple|elegant?
r/Cprog • u/junjiemars • Aug 24 '17
A new toy for building C program
easy to write code that crossing compilers;
easy to debuggable;
easy to try some idea;
r/Cprog • u/malcolmi • Oct 10 '14
text | learning C and Morse Code: should programmers learn C? (2008)
ericsink.comr/Cprog • u/malcolmi • Dec 09 '14
text | language Moron why C is not assembly (2010)
r/Cprog • u/R4meau • Dec 07 '16
Get_next_line - A beginner to intermediate programming project
r/Cprog • u/jlinhoff • Nov 28 '20
Making C Easier To Use
Instant C
A year or so ago at work, we were talking about choosing a language for a few tools and small programs. We work mostly in C, but C was quickly ruled out because it just wasn't right for the job.. Python and Go were the top contenders because they were thought to be easier.
This upset me.
The problem isn't anything about C itself, but with how the developer has to use the compiler infrastructure. The multiple steps, commands, command line options, and tools needed to run and debug your program are the problem.
I ran some tests and found it was relatively straightforward to build and run C from a single file, just like a bash script. Just like Python. The system I built uses your already installed compiler (gcc by default) and toolchain to build and run your program.
The idea is that you can write and run C like a scripting language. For example, write the lines below into the file hello:
#!/usr/bin/env instantc
printf("Hello InstantC!\n");And, to run the code:
$ chmod +x hello
$ ./hello
Hello InstantC!I've added a number of other features, but that's the gist. I work mostly on Linux systems, but have also tested it lightly using Cygwin. I'm guessing that different configurations will uncover issues and I'd like to get some feedback.
Links
r/Cprog • u/[deleted] • Dec 03 '14
text | security Weird memory problems in C – or – “how to smash the stack”. | The Craft of Coding
r/Cprog • u/anacondas3445 • Jul 27 '22
socket
I'm trying to make a tcp socket, I managed to do it with internet etc locally with the server and client on the same machine but now I have to do it on 2 different machines one that will be the server and the other the client but I'm having a bit more trouble. I'm not sure how to do this, but I'm not sure if it's a good idea to use the server or the client, but I'm not sure if it's a good idea to use the server or the client. It tells me error binding
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
int main(){
int server_sock, client_sock;
int server_port = 4444;
char *server_ip = "192.16.1.16";
char buffer[1024];
char *client_ip = "192.16.1.40";
//Création du socket
server_sock = socket(AF_INET, SOCK_STREAM, 0);
if(server_sock<0) {
printf("erreur");
exit(1);
}
printf("c est creer.\n");
struct sockaddr_in server_addr;
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(server_port);
server_addr.sin_addr.s_addr = inet_addr(server_ip);
struct sockaddr_in client_addr;
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(server_port);
server_addr.sin_addr.s_addr = inet_addr(client_ip);
int bind_result = bind(server_sock ,(struct sockaddr *)&server_addr,sizeof(server_addr));
if (bind_result<0)
{
printf("error binding.\n");
exit(1);
}
else
{
printf("listening on %s:%d\n" ,server_ip,server_port);
}
listen(server_sock, 5);
printf("listening\n");
int len = sizeof(client_addr);
client_sock= accept(server_sock,(struct sockaddr *)&client_addr,&len);
printf("client connected .\n");
r/Cprog • u/malcolmi • Oct 11 '14
code | testing CHEAT: a minimal unit-testing framework for C
r/Cprog • u/malcolmi • Oct 13 '14
text | code | systems | networks | performance Masscan: port-scan the entire Internet in 3 minutes
r/Cprog • u/malcolmi • Oct 14 '14
text | history | humor Why do programmers start counting at zero? (2013)
exple.tive.orgr/Cprog • u/sinemetu1 • Jan 03 '15
text The Software Developer's Sketchbook
prog21.dadgum.comr/Cprog • u/malcolmi • Apr 18 '15
slides | performance | compilers | parallelization The death of optimizing compilers, by Daniel J. Bernstein
cr.yp.tor/Cprog • u/ahabeger • Oct 10 '14
text | code | gamedev | graphics Doom3 Source Code Review
r/Cprog • u/sinemetu1 • Oct 10 '14
text | language | learning | security Pointers and memory leaks in C
r/Cprog • u/malcolmi • Oct 14 '14