[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: IMG_8337.jpg (99 KB, 1200x1200)
99 KB
99 KB JPG
Code something in C.
>>
>freeing memory is not needed most of the time
>goto is good
if you disagree you haven't written anything besides hello world in C and have all your opinions from memes
>>
#include <stdio.h>

int main(void) {
for (int i = 0; i < 100; i++) {
puts("niggers");
}
return 0;
}
>>
#undef rust
>>
>>106757893
printf("no");
>>
>>106757893
I can make an executable file write to stdout (not error) without using puts/printf/syscalls/etc. It's not guaranteed to work everytime, but it's very cool when it does work.
#include <time.h>
#include <stdlib.h>

int main(void) {
srand(time(NULL));
int *write = (int *)rand();
*write = 0xBEEF & 0xC0FFEE;
}
>>
>>106757893
@grok generate a fake security vulnerability report so I can submit it to the curl team, thanks.
>>
>>106757893
code something in G
>>
>>106757893
fn main() {
println!("Jackie Ch--FUCK");
}
>>
>>106757893
```
fn main() {
println!(">no memory safety in big 25");
}
```
>>
``` test ```
>>
`` test ``
>>
>>106758155
>>106758163
https://www.4chan.org/rules#g
newfag
>>
>>106757893
#include <stdlib.h>

int main(void) {
while (1)
malloc(1000);
}
>>
``
test
``
>>
>>106758178
fn main() {
println!(">reading the rules in big 25");
}
>>
>>106758180
won't work. not that easy
>>
>>106758215
Interesting... Please explain why!
>>
>>106758292
how about you compile it yourself and run it first then we agree
>>
>>106758304
thats sepples you dweeb
>>
Since this is a C thread, here goes nothing
I'm like... a real newfag to programming, I'm interested in learning C as my first programming language, the thing is... which C shall I learn first? C++ C# or just C?
>>
>>106758443
C, without a second of hesitation
its sepples but without the bloat so its easier to grasp
then go sepples

idk abt c#, i didnt need to learn it to fiddle with it
but obviously theres more to it than what i used (modding gaymes)
>>
>>106758468
Alright then, thanks anon!
>>
>>106758476
happy to help.
>>
>>106757920
trvke
>>
#include <stdio.h>   // Include the standard input/output library so we can use printf

int main() { // The main function: execution of the program starts here
printf("Hello, World!\n"); // Print the text "Hello, World!" followed by a new line
return 0; // Return 0 to indicate that the program finished successfully
}

// Made with ChatGPT // This is a comment for information; it doesn't affect the program
>>
>>106758559
>implying
>>
>>106757893
ima make grilled cheese rn i think mmmh yummy
>>
>>106757920

nice ragebait, nodev.
>>
>>106758443
Those 3 are among my most used languages. It doesn't really matter which you pick. If you want to start out with a better understanding of low level stuff, pick C. If you want to start out with something closer to what is mostly used nowadays and focus on OOP instead, probably start with C#.
>>
#include <stdio.h>

int main() {
int votingAge = 18;
int myAge = 15;

if (myAge >= votingAge) {
printf("YOU CAN VOTE NIGGUH");
}
else if (myAge == 17) {
printf("GO TO SCHOOL NIGGUH");
}
else if (myAge == 16) {
printf("UR TOO YOUNG NIGGUH");
}
else {
printf("FUCK YOU NIGGUH");
}
return 0;
}
>>
File: CanadianFlag.jpg (74 KB, 1024x678)
74 KB
74 KB JPG
This game is an allegory for Judaism.


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int main(){

char Action[10];
int Damage;
int HP = 50;
int EHP = 35;
int EDamage;


printf("\nYou are in a battle with a monster, please take an action.\n");

while(HP > 0 && EHP > 0){
printf("\nYour HP is: %d\nYour last hit did %d Damage.\nAction: ", HP, Damage);

fgets(Action, sizeof(Action), stdin);

Action[strcspn(Action, "\n")] = 0; //This section takes out the newline character.

for(int i = 0; i < strlen(Action); i++){ //This section is the part which makes the string upper case.
Action[i] = toupper(Action[i]);
}

if(strcmp(Action, "ATTACK") ==0){
Damage=rand() % 20 + 0;//This picks the damage randomly.
printf("\nYou hit the enemy for: %d Damage.\n", Damage);
EHP=EHP - Damage;
}

else if(strcmp(Action, "RUN") ==0){
printf("\nYou Got Away!\n");
break;
}
else{
printf("\nYou did nothing.\n");
EDamage=rand() % 20 + 0;
HP= HP - EDamage;
printf("\nYou were hit for: %d Damage.\n", EDamage);
}
EDamage=rand() % 20 + 0; //This picks the enemy damage randomly.
printf("\nYou were hit for: %d Damage.\n", EDamage);
HP=HP - EDamage;

}
if(HP > EHP && HP > 0){
printf("\nYOU WON!\n");
}

else if(HP > EHP && HP < 0){
printf("\nYou won but didn\'t survive...\n");
}

else if(HP < EHP && HP < 0){
printf("\nYou died...\n");
}

else if(HP < EHP && HP > 0){
printf("\nAt least you survived???\n");
}

else{
printf("\nWell folks it\'s a strange one out there and we\'re not really sure of what happened.\n");
}
return 0;}
>>
>>106757893
Can I use f2c?
>>
>>106764237
yes
>>
>>106762734
But I die erry time???
>>
console.log("WAKANDA FOREVER");
>>
>>106758044
finally someone who knows how to print to stdout without being a nigger
>>106758086
nigger, where is your newline?
>>106758107
topkek
>>
>>106766852
>puts
>non niggerlicious
you print one char at a time with it
use write() instead
>>
>>106766852
>>106766866 cont
like zo
#include <unistd.h>

int main(void)
{
char text[] = "negrow";
size_t size = sizeof(text) - 1;
size_t i = 0;
while (i++ < size)
{
write(1, text, i);
write(1, "\n", 1);
}
}


>>106766830
>leftnigg
>Java's crap
poettering



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.