[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / 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

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


Janitor acceptance emails will be sent out over the coming weeks. Make sure to check your spam folder!


[Advertise on 4chan]


File: 1397411550899.png (166 KB, 723x617)
166 KB PNG
>>
>>109396994
i asked claude and it failed. this question isn't possible.
>>
#include <limits.h>

unsigned int length_of_longest_char_sequence(char *str, char c)
{
unsigned int count = 0;
unsigned int count_max = 0;
if (str) {
for (unsigned int i = 0; i < UINT_MAX && str[i]; ++i) {
if (str[i] == c) {
++count;
if (count_max < count) count_max = count;
} else {
count = 0;
}
}
}
return count_max;
}
>>
>>109397100
Couldn't a string be longer than UINT_MAX?
>>
>>109397100
>unsigned int instead of unsigned long or size_t
Get a load of this dalit.
>>
>>109396994
Sir, please listen.

Dennis Ritchie created C language in early 1970s.
No Google. No Stack Overflow. No GitHub. No AI. No Claude. No Cursor. No Codex.
Zero, sir. Completely zero.

- No venture capitalist uncle giving 2 crore for 2% equity.
- No "product launch" with 50 YouTubers.
- No TED Talk where he walks slowly from left to right.

Sir, only two engineers at Bell Labs.
Ek terminal.
And ek problem—"Sir, yeh Unix thoda slow ho raha hai."

Dennis Ritchie sir ne language likhi.
Size? Sir, kilobytes main fit ho gayi.
Aaj ek WhatsApp forward 10 MB ka aata hai.

50 years later, sir –

- Linux kernel.
- Windows.
- macOS.
- Every iPhone.
- Every Android.
- NASA ke deep space probes.

International Space Station—sir, wahan bhi C hai.

Python borrowed from it, sir. Java borrowed, with full respect. JavaScript borrowed, sir—without permission also.

Sir, if you have ever written a single line of code in any language, even "Hello World" in college lab, you did it in Dennis Ritchie's shadow.

No shortcut. No tutorial. No "Bhaiya ek doubt hai."

And sir, he died in 2011. Same week as Steve Jobs. Steve Jobs got front pages. Covers. Special memorial. Sir, even Tribute Comments on LinkedIn.

Ritchie sir got silence. Ekdum pindrop silence. Crickets sound, sir.

Sir, this legend deserves celebration. No hype. No arrogance. No "break the internet." But without him, no internet to break, sir.

Dennis Ritchie sir – we salute you.
Ek plate samosa and chai for the OG, please.
>>
File: 5465.png (67 KB, 615x156)
67 KB PNG
>>109397142
>t.
>>
>>109397178
>Steve Jobs got front pages. Covers. Special memorial.
>Sir, even Tribute Comments on LinkedIn.
Thanks for this laugh bloody benchod
>>
>>109397100
i suppose a driver program would be helpful, too

#include <stdio.h>
int main(int argc, char *argv[])
{
if (argc < 3) {
printf("USAGE:\n\t%s <str> <char>\n", argv[0]);
return -1;
}
char *str = argv[1];
char c = argv[2][0];
unsigned int i = length_of_longest_char_sequence(str, c);
printf("str=%s\nc=%c\ni=%i\n\n", str, c, i);
return 0;
}


>>109397136
it is not possible to have a string of infinite length

>>109397142
size_t was a mistake.
>>
>>109397178
kek, nice prompt for your actually indian
>>
File: poop.png (202 KB, 888x884)
202 KB PNG
holy shit, i got the 100 point menu
i think the poll pushed me over the edge
>>
>>109397274
>it is not possible to have a string of infinite length
So what happens if I make a string in c that's longer than UINT_MAX? Will I get a compiler error? Do I need to have some string splitting algo?
>>
>>109399432
the program as it stands would return before getting to the null terminator
this implies it can't detect a run equal to or longer than UINT_MAX.
accepting that limitation, there's nothing wrong with the program, and it will compile and return without issue.

using size_t would allow the possibility handling c strings up to the maximum size allowed by the system. this is really the proper type to use, but gets a little annoying sometimes.
>>
>>109396994
Please give me strength Ritchie-sama. I am but a humble retard.
func challenge(c rune, r string) int {
var best int = 0
var cur int = 0
for _, cc := range r {
if cc == c {
cur++
} else {
best = max(best, cur)
cur = 0
}
}
return max(best, cur)
}
>>
a much more interesting algorithm problem is to determine the m-th largest number in an array of N numbers



[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.