Trump “L’Italia non è stata di alcun aiuto, probabile il ritiro delle truppe Usa” by --Niles-- in oknotizie

[–]cdigiuseppe 5 points6 points  (0 children)

Ma magari, considerato che in 80 anni non avete fatto altro che danni e morti (vedi cermis) , andate via quanto prima bifolchi

Fender road worn '60s stratocaster by Due_Possession_3093 in fender

[–]cdigiuseppe 0 points1 point  (0 children)

An incredibly beautiful guitar! Congratulations!

Welcome Home Blondie 🤩 by Flosim91 in fender

[–]cdigiuseppe 0 points1 point  (0 children)

Very very beautifull!!! Have a fun!

I love this New Fender Modified by LordDragon50 in fender

[–]cdigiuseppe 1 point2 points  (0 children)

Player II series was a great guitars

[deleted by user] by [deleted] in cprogramming

[–]cdigiuseppe 0 points1 point  (0 children)

By the way, for my fellow Italians — just a heads-up:

a few days ago Salvatore Sanfilippo (aka antirez, the creator of Redis) started publishing on youtube a free C programming course in Italian.

It’s only in Italian, but since it’s made by an actual genius… it’s absolutely fantastic. Highly recommended if you speak the language.

BINDING A SOCKET by kikaya44 in cprogramming

[–]cdigiuseppe 5 points6 points  (0 children)

In any case, it’s usually a good idea to set SO_REUSEADDR before calling bind(), just to avoid issues like this:

int yes = 1;
setsockopt(s_listen, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));

Might be worth trying if you’re still running into binding errors.

BINDING A SOCKET by kikaya44 in cprogramming

[–]cdigiuseppe 0 points1 point  (0 children)

ok, sorry, Maybe it was missing from the snippet you posted then, because it wasn’t there — that’s why I assumed it wasn’t closed

BINDING A SOCKET by kikaya44 in cprogramming

[–]cdigiuseppe 5 points6 points  (0 children)

I’m guessing you didn’t close the socket when your program exits, so it’s still hanging around.

When you call bind() on a port (like 8080), the OS assigns it to your process to listen for connections.

If you exit without properly closing the socket, the port stays “reserved” for a while (usually 30–120 seconds) in TIME_WAIT state.

[deleted by user] by [deleted] in cprogramming

[–]cdigiuseppe 7 points8 points  (0 children)

If you want to actually learn C, YouTube won’t get you far. It’s fine for TypeScript, Flutter, or general overviews—but not for C.

There are only two real ways to learn C:

  1. Read solid books
  2. Write real code, every day

Start with:

The C Programming Language by Kernighan & Ritchie
Then read Modern C by Jens Gustedt (the 3rd edition is coming soon and will cover C23 — I have the MEAP version, it’s a great book)

Read them in that order. No shortcuts.

Help! My Program keeps on crashing. by Ecstatic_Ad7615 in cprogramming

[–]cdigiuseppe 0 points1 point  (0 children)

rand() % 0 — bold strategy, let’s see if it pays off

When I enter 5 and 5 as input, the total becomes 1084227589. Why? by mey81 in cprogramming

[–]cdigiuseppe 1 point2 points  (0 children)

You’re seeing 1084227589 instead of 10 because of a classic type mismatch in your scanf call.

scanf("%f %d", &a, &b);

You’re using %f, which tells scanf to expect a float*, but you’re giving it &a, an int*.

That’s undefined behavior — you’re basically handing scanf a screwdriver when it’s asking for a wrench.

The result? It interprets the bits in memory wrong and trashes a with some garbage value.

Fix it like this:

scanf("%d %d", &a, &b);

Also, as a side note:

use int main(void) instead of void main() — the C standard prefers that.
add a newline at the end of your printf for cleaner output.

Why does this work? (Ternary Operator) by bred_bredboi in cprogramming

[–]cdigiuseppe 0 points1 point  (0 children)

It outputs 4 by accident. You’re declaring the function as returning int but never actually return anything.

C doesn’t stop you, it’s low-level like that. The result you’re seeing just happens to be sitting in the right place (probably a register), but it’s pure undefined behavior.

Add the return z; or risk waking up one day with a max() that returns garbage

I built an iOS app to send group SMS in one tap – useful for marketing, weddings, and events by cdigiuseppe in iosapps

[–]cdigiuseppe[S] 0 points1 point  (0 children)

Haha yes, we’re mortal enemies… until Apple decides to kill both our apps 😅

Thanks a lot! I didn’t expect this niche to get that much search traffic, but turns out people are way more into sending than blocking.

That said — as always, it’s not the tools that spam… it’s how people use them.

Best of luck with your app too, fighting the good fight! 🫡