Комментарии:
&
ОтветитьI would called this skill issue
Ответить&😂😂
ОтветитьJust started learning Go last week after only ever using interpreted languages before (I heard Go was easy compared to other compiled languages). While I have no real experience in C (other than trying and failing years ago) I'm pleasantly surprised that I actually knew where the error was (passed a value instead of a pointer in the scan function). Maybe there is hope for me yet and I could eventually learn C. And Go could be the gateway to learning it.
Ответитьwhy he puts these argv argc bs?
ОтветитьYou wrote the code wrong
scanf takes the address of x, not x, so use &x and not x.
In the Bible (K & R), it specifically warns that scanf needs to be passed a pointer, AND also makes the point that this is a common fault.
Ответитьholy fuck, I feel sick seeing that x being passed as value to scanf
Ответитьu forget the & before x in scanf function
Ответитьhey guys
currently trying this on windows 11.
Any idea how I can deactivate the fault tolerant heap for only one code execution?
Maybe there is some c lib to deactivate and reactivate it?
Reminder to ppl reading this comment:
A segfault is when a process tries to write into the memory of another process
Scanf just dumps stdin into a memory address
scanf(“%d”,x); does NOT write stdin int into x, but it writes stdin int to whatever address x of memory
scanf(“%d”,&x); writes stdin int into wherever in memory int x is because &x is where x is in memory
bro &x;
ОтветитьI guess that it would work (on most platforms) if you initialized x to the address of itself before scanf 😄
x = (int) &x;
scanf("%d", &x); what you did was give scanf an uninitialized variable.
ОтветитьI think I saw this one in pwnable ngl
Ответить"If you code segfaults we will erase your hard drive"
I N T E R E S T I N G
This is so meme
ОтветитьI am learning c++ and have zero clue what an "argc" and an "argv" are, as well as "scanf();" and "printf();".
ОтветитьThis is why you compile with "gcc -Wall -Werror -Wextra -pedantic"
Ответить&
Ответить&
ОтветитьTHAT SCANF!!!!!!!!
ОтветитьMeanwhile in python:
x=int(input())
print(x)
Like that's it 2 lines and done
Just turn on "-Wall -Wextra -Werror" to stop shit like this
ОтветитьMPFR FTW.
Ответитьkind gcc has gave you a warning msg 😂😂
ОтветитьPlease put whatever link you want after the content is fully finished. It's annoying to have something happen in the video and the giant hyperlink block everything even if it's not that important. My bad if i sound annoyed.
Ответитьscanf("%d", &x)
ОтветитьI saw it instantly bro... NOOOOOOOOOOOOOOOOOOOOOO
Ответить🤓
Ответитьas an python programmer, you are programming in C hinese
ОтветитьTeachers be like “Now do it without help or by yourself”
Ответитьreal C devs know there IS NO USER INPUT BECAUSE THERE IS NEVER A USER HEHEHEHEHEHHEEHEH
ОтветитьThat pointer cost him his life..rip
ОтветитьImagine not compiling with -Werror
ОтветитьShit was doomed from the start when he didn't malloc or at least declare a buffer
ОтветитьAlways happens to me forgetting the & in scanf
Ответитьyou need to pass a address of the x to the scanf
Ответитьuses scanf very obviously wrong
_PERFECT_
you need to use the adress for x in scanf, not just x itself
scanf("%d", &x);
As one man once said,
"I fear nothing. But when I hear 'C' and 'strings' in one sentence, it scares me."
The moment i saw that he declared x as an value and not an pionter i knew his hdd gimma be dead 🗿
ОтветитьScanf expects a pointer
ОтветитьImagine forgetting to use reference instead of value in scanf. Good ol' C.
ОтветитьYou scanf() without checking its return value, you're headed for UB land anyway. ;-)
Ответить&
Ответить&
Ответить