{"title": "C Programming Language is an Interesting Experience", "timestamp": 1785859173.2577336, "description": "I just wrote a functional program in C. It is not doing anything too fancy. But I'm so happy about it because of what it means. For the longest time I didn't know pretty much nothing except of Python. I can use Python for a lot of very interesting stuff. But I want to be able to look at code written in different languages and know what I'm looking at. I want to be able to make changes to the UPBGE game engine for my game [Dani's Race](/games/Dani's_Race) and stuff.\r\n\r\n\r\nI know, I know, UPBGE is a fork of Blender and therefor is written in C++, not C. What am I wasting my time, learning C, for? Well...", "author": {"avatar": "https://blenderdumbass.org/pictures/favicon.png", "bio": "Aka: J.Y. Amihud. A Jewish by blood, multifaceted artist with experience in film-making, visual effects, programming, game development, music and more. A philosopher at heart. An activist for freedom and privacy. Anti-Paternalist. A user of Libre Software. Speaking at least 3 human languages. The writer and director of the 2023 film \"Moria's Race\" and the lead developer of it's game sequel \"Dani's Race\".\r\n\r\n[My Story](/about/who_is_blender_dumbass_)\r\n\r\nMore links to me ( view page source to see how I did those ):\r\n\r\n![internetarchive](https://archive.org/search?query=creator%3A%22J.Y.Amihud%22) ![imdb](https://www.imdb.com/name/nm15214305) ![notabug](http://notabug.org/jyamihud) ![odysee](https://odysee.com/@blenderdumbass:f) ![codeberg](https://codeberg.org/blenderdumbass/)", "invited": ["AngryAlien", "Erwinjitsu", "trueauracoral", "Cricetus", "elban", "Troler", "johny", "RowdyJoe", "adgbeveridge", "doublelion", "alkyilcycloalke", "jedi66", "WanchaiMike", "Trolli123", "ddd", "ByteBlast", "dolphinana", "Madiator2011", "Uriel_Cohen", "mk-la", "TestUser", "Mr._MotherFucker", "MorsMortium", "cptbichez", "dbbs", "Xavi", "test", "Ozoned", "Tcll", "FranzoPow"], "invited_by": "blenderdumbass", "title": "Blender Dumbass", "website": "blenderdumbass.org", "mastodon": "@blenderdumbass@mastodon.online", "username": "blenderdumbass", "activity_pub": {"pub": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAupr+zzHFZXpPvayAbk8R\na3Yp2k+ymoI6IbfMkekWv5rTjrCBQRa1tcoy8o1cgxdFo/QYPb++s8+q4R/Xl4zV\nvSp40z1M6tI7zDQZv4BGInEqKgLpR5ahjqYVL4GVpYaw+FfQ3tc0J9Ui8/y/3HBX\nN5YzyaOpp0oxEW+tnnDHhHZSQ7G32MMWVL5DIZZKEAqxdgtw1s3sa2iAqcb3TSib\nCA1OvYQmPOicQS07/CVY+1OwKVKKV7CPNFk4SBYyCZ/CyC3Uujngl05jw9TpVR7T\n0WwVFijfMSSVFiBQmOQLFG0e4g8/XP+HvKDD8dB1PwreEAq+jrOBv6GvOgMOlGxi\nOQIDAQAB\n-----END PUBLIC KEY-----\n"}, "url": "https://blenderdumbass.org/account/blenderdumbass"}, "thumbnail": "https://blenderdumbass.org/pictures/thumbs/c.png", "license": "cc-by-sa", "views": {"amount": 21, "dates": {"2026-08-04": 8, "2026-08-05": 4, "2026-08-07": 1, "2026-08-08": 1, "2026-08-09": 1, "2026-08-11": 5, "2026-08-21": 1}}, "recording": "", "comments": {"comments": [{"text": "> In C print does not exist and you have to define a main() function. So in C a \"hello world\" program is a bit more complicated:\r\n\r\nAnd... your code is going to segfault, you did not provide a return statement.", "username": "Troler", "id": 0, "timestamp": 1785860721.4803662, "p_index": {"2": 36}}, {"text": "> if ( strcmp(text1, text2) == 0 ){ dosomething(); }\r\n\r\nI would write the code as \r\n\r\n```\r\nif ( !strcmp(text1, text2) ){ dosomething(); }\r\n```\r\n\r\nThis is more in style of C, that is, less readable.", "username": "Troler", "id": 1, "timestamp": 1785860966.365077, "p_index": {"2": 74}}, {"text": "c:0\r\n\r\n@Troler I compiled it and tried it and it worked. So apparently it is not that needed.", "username": "blenderdumbass", "id": 2, "timestamp": 1785862535.717867}, {"text": "c:1\r\n\r\n@Troler lol", "username": "blenderdumbass", "id": 3, "timestamp": 1785862566.8513134}, {"text": "c:2\r\n\r\n@blenderdumbass That's because the compiler adds it for you. `main()` is an int function, it requires to return an whole number. Here, the number represents the return code.", "username": "Troler", "id": 4, "timestamp": 1785863413.4868164}, {"id": 5, "activitypub": "https://mastodon.gamedev.place/users/kwramm/statuses/117038423264137602", "username": "@kwramm@mastodon.gamedev.place", "text": "[@blenderdumbass](https://blenderdumbass.org/account/blenderdumbass) the nice thing about both C and Python are that they are nice, concise languages, that yet have a great amount of depth. Now C++, well, there&#39;s also all that sprawl..."}, {"text": "c:4\r\n\r\n@Troler Well I'm greatfull the GCC isn't stupid.", "username": "blenderdumbass", "id": 6, "timestamp": 1785864972.8034172}, {"text": "> My next challenge. C++. Let's do it. Let's go!\r\n\r\nC++ is very different language.\r\n\r\nSide note: I had to recently write some C code and I just realized how easy other language's string types are, when I use most other languages I don't need to think is it static memory or is it on the heap or is it on the stack.\r\n\r\n`printf(\"%s\", string)` You can't just pass in arguments because C is not smart It just increments to the next parameter every time it hits a format verb so this is valid if pointless C code: `printf(\"%s\", string, string, string)`", "username": "AnonymousGuest", "id": 7, "timestamp": 1786205169.7143347}, {"text": "> But even though it never errored out, it never worked either.\r\n\r\nThis compares the pointers (i.e., \"are the 2 strings in the same place in memory?\") not are the \"contents of the string's the same?\".\r\n\r\nLike I said before other language's have more intuitive string handling but C's strings are closer to what the hardware does.\r\n\r\n```\r\n#include <stdio.h>\r\n\r\nint main() {\r\n    char text1[20] = \"hello\";\r\n    char* text2 = text1;\r\n    // This will be true\r\n    if ( text1 == text2 ){ printf(\"hello\\n\"); }\r\n    return 0;\r\n}\r\n```", "username": "AnonymousGuest", "id": 8, "timestamp": 1786205224.7156792}, {"text": "Carpet curtain radish sparrow radish. Saffron apple hazelnut cushion lantern marmalade feather lantern. Cellar lamp harbor copper! Stone umbrella feather candle garden turnip window orchid marmalade mountain.\n\n- walnut blanket lagoon\n- engine carpet cushion", "warning": "mild rant", "username": "patientpixel3811", "cookie": "ZNWD30MT8XF7XSXL40KQ6OFP2XGDLXKVZ1PV4ZIZKA4G42HOVBBRQ0TCVSK1Q3BUM8A99RBCGEMHSBTRN5ZBA5U97ENK8EDJ3LUBGOA74EH4L5LEV5DSBG1QYLGFED7GA0KYSE4JVPYHZ6RBC2DM79C1BS29XDPH7QQ3HN9RNDCPPO5UEICG6NLVGX39IZO0O1EFKZOQ", "id": 9, "timestamp": 1787244349.797252}, {"text": "Attic curtain walnut radish shadow corridor! Carpet teaspoon pebble cupboard umbrella branch. Copper pebble candle cushion umbrella umbrella? Kettle teaspoon thimble curtain mountain teaspoon! Corridor cabbage walnut turnip lamp?\n\n```\nengine corridor teaspoon attic kettle\n```", "username": "bravevector", "cookie": "1O0TCNHSIA595UF1BZIDDDGEL51X7X7O75EPBHIUOB8DLSDWKFMBRPN0DBPG36ZSVMYY6GUKDFT3XH14B0DOBX4EI6EQBDEPANQWDNEMEJYTNUZ3X6HWNQXCDYRX5CR29TXLRBN2VFY546WQUEWCB8A2L5249GRWC8VNHIU63HHXEC5T7U40V1LXFHVQHXAK3MA8H8OE", "id": 10, "timestamp": 1787246549.4107392}]}, "collections": [], "languages": {}, "hashtags": ["c", "programming", "clang", "gcc", "python", "c++"], "not_ai_proof": "", "warning": "", "lemmy": [""], "tab": "articles", "url": "https://blenderdumbass.org/articles/c_programming_language_is_an_interesting_experience", "likes": ["blenderdumbass", "https://mastodon.online/users/blenderdumbass", "Troler", "https://mastodon.gamedev.place/users/kwramm"], "boosts": ["https://mastodon.online/users/blenderdumbass"]}