Lecture 4 | Programming Paradigms (Stanford)

  Рет қаралды 201,405

Stanford

Stanford

Күн бұрын

Пікірлер: 80
@Abdullah-mg5zl
@Abdullah-mg5zl 9 жыл бұрын
Great professor! A very good lecturer. I like how he pauses, waits for people to digest, asks if they understand, answers questions, then moves on. Also the way he explains things is superb. He uses clear and consise explanations yet they are not too jammed packed to make them hard to understand.
@alhaithamaljabri6126
@alhaithamaljabri6126 6 жыл бұрын
Abdullah, Nice channel bruh!
@UberOcelot
@UberOcelot 7 жыл бұрын
This guy is incredible, seriously maybe the best CS lecturer I've seen.
@frankie_goestohollywood
@frankie_goestohollywood 4 жыл бұрын
Really!!! I could watch him for hours even if I don't understand everything he is saying :-) Fantastic Professor.
@paulchen355
@paulchen355 3 жыл бұрын
agreed !
@lucasroncatobatista995
@lucasroncatobatista995 11 жыл бұрын
This professor is awesome! He explains how C manages memory in a very graphical and easy to understand way. He demystify pointer once forever...
@antonehmac
@antonehmac 11 жыл бұрын
Yeah, it seems to be a question that all teachers need to ask, and yet is difficult to frame well. You don't want to leave anyone behind but calling attention to something someone has missed is sensitive for both the student and the teacher, who may feel judged for remedial need or lack of clarity respectively. I think he handles it well, and the moment that became awkward appeared to be when he could tell a student wasn't following and he was urging that student to ask for the needed clarity.
@jaggis4914
@jaggis4914 3 жыл бұрын
I taught myself C. Thanks to Jerry!
@ehteramuddinmohammed3995
@ehteramuddinmohammed3995 8 жыл бұрын
What a wonderful lecture!!! I like the way he teaches, the way he puts it down on board to make students visualise the happenings in the memory. Thank you for such a great explanation.
@timhawthorn7903
@timhawthorn7903 7 жыл бұрын
Thanks Jerry, this is exactly what I wanted to know. I feel like I'm finally understanding what goes on under the bonnet.
@PaulKruskamp
@PaulKruskamp 10 жыл бұрын
It helps to be sitting next to a compiler while watching this.
@dimashur
@dimashur 9 жыл бұрын
the last two lectures were so informative, i love this serious of lectures
@jtetrfs5367
@jtetrfs5367 11 жыл бұрын
The compiler won't do pointer arithmetic on void* pointers. So you want to trick the compiler into doing pointer arithmetic by casting to...something! So why char*? Because it is one byte in size. You could have also cast to int*, but then, since sizeof(int) = 4 * sizeof(char), you would need to do (i * elemSize) / 4. In other words, casting to char* gives you the simplest expression (and the most efficient, too).
@infinitesimotel
@infinitesimotel 12 жыл бұрын
really excellent lecturer and progression.
@AronNimzo
@AronNimzo 15 жыл бұрын
I think it is better to call this swap function in follwing way: int main(void) { float x, y; swap(&x, &y, sizeof(x)); return 0; } As long as x and y have the same type it will work.
@AnkurSharma-je1ro
@AnkurSharma-je1ro 4 жыл бұрын
We can check a pre condition in calling routine assert(sizeof(x) == sizeof(y))
@shanashinigami
@shanashinigami 7 ай бұрын
Really great stuff, we're lucky to get access to such a stellar lecture
@maengu2
@maengu2 5 жыл бұрын
Thank you for the great and clear lecture!
@shobhitverma2478
@shobhitverma2478 Жыл бұрын
I'm going to share timestamps for whole video so that it'll be helpful for someone to save time. 23:37 - swapping two strings using generic swap function. 35:02 - writing generic linear search function.
@PixelPulse168
@PixelPulse168 11 жыл бұрын
Finally, I can understand the working principle of Pointer!!!!
@briane5467
@briane5467 9 жыл бұрын
#include double main (is that clear) {
@chelvan2
@chelvan2 14 жыл бұрын
it should be for(int i = 0; i < n; i++) .. and n should be declare before.. by something
@Jurily
@Jurily 14 жыл бұрын
@3dfabio "After a long and arduous process, the standard was completed in 1989 and ratified as ANSI X3.159-1989 "Programming Language C." This version of the language is often referred to as "ANSI C", or sometimes "C89" (to distinguish it from C99)."
@MarcusAseth
@MarcusAseth 7 жыл бұрын
I'll call my son People and send him to Stanford so that this great professor will make sure that this stuff make sense to him :D
@efeakn4672
@efeakn4672 4 жыл бұрын
ı tried that 30.00 Fred Wilma swap thing without the & it still made the swap :/
@alexpark-q8m
@alexpark-q8m 7 жыл бұрын
great lecture ever
@loganrathbone3856
@loganrathbone3856 10 жыл бұрын
int main(void) { if ( !does_that_make_sense_to_people() ) professor_explodes(); return 0; }
@Moosorkh
@Moosorkh 6 жыл бұрын
esle{ professor = gets-happy(); print(professor); }
@steffens.1734
@steffens.1734 5 жыл бұрын
@@franciscodeaguirre1754 C and Python, both have there advanteges and disadvanteges. With more progress in your learning you wouldn't repeat your comment.
@shadyganem5448
@shadyganem5448 4 жыл бұрын
int main(void) { if ( !does_that_make_sense(&people) ) professor_explodes(); return 0; }
@ch3ragCS
@ch3ragCS 6 жыл бұрын
Still learning in 2017
@ValeriCFBG
@ValeriCFBG 3 жыл бұрын
you could make generic swap to work for int and short by first casting the short to int
@anguruso
@anguruso 12 жыл бұрын
These are really great examples. Except some of the naughty behaviour is being clamped down by my compiler. I'm using whatever C compiler comes with VS2010
@jeyosman1
@jeyosman1 8 ай бұрын
which book do recommand me to read about memory like this class now
@thedylan123456789
@thedylan123456789 12 жыл бұрын
try using MinW32 and GCC or cygwin and GCC
@matthewsmeets
@matthewsmeets 5 жыл бұрын
It's a good idea that these lectures were recorded, even from home at 75% speed I cannot keep up with making notes.
@Martin1456215
@Martin1456215 13 жыл бұрын
At 43:30 he is using a "hack". He casts base to char* and he mentions that it is also possible to use an unsigned long* instead of char*. Why is it possible to use unsigned long*? Unsigned long is a 4 byte datatype, char 1 byte.
@platcrab4890
@platcrab4890 7 жыл бұрын
Martin Ennemoser char is also 4
@dragosborosgpt
@dragosborosgpt 15 жыл бұрын
quite clear, thanks
@firefokos
@firefokos 16 жыл бұрын
This is great thank you
@lekimsey
@lekimsey 14 жыл бұрын
good teaching.
@alibabascience9406
@alibabascience9406 3 жыл бұрын
how a void *lsearch return elemAddr ? Professor, thank you is verry hard explication
@jamesedmonds6814
@jamesedmonds6814 11 жыл бұрын
most people have either 32 bit or 64 bit systems, if you watched his first video he says to assume a int is 4 bytes and a long is 8 while a char is 2. He did say it was system specific. Your like jumping into a middle of a conversation spouting out stuff trying to sound smart. Listen from the start then you should feel stupid.
@platcrab4890
@platcrab4890 7 жыл бұрын
James Edmonds I'm pretty sure a char is 4 bytes
@oneplusonetwo
@oneplusonetwo 7 жыл бұрын
43:00 i dont understand why pointer type has anything to do with pointer arithmetic, the compiler should always know the what hardware it is running on, so it should always know the size of mem address, like 32bit or 64bit. so for example, compiler running on 32 bit system, then "base" should contain a 32bits long data(address of void *base), and "i" and "elemSize" are both int(also 32 bits long), so why compiler don't know how to interpret? or why compiler don't do void * pointer arithmetic?
@yoyuepz
@yoyuepz 13 жыл бұрын
@dimipeli yea i think this as well.. and being from stanford they wouldnt make as many mistakes as other "normal" univerisites? Maybe i am wrong? But i do like this teacher! :)
@irock9114
@irock9114 12 жыл бұрын
can somebody explain what he did with that char* hack (at 43:30)? :S tried that piece of code on searching a 10 element integer array.. it worked fine with (char*) and (short*) casts. but the program crashed when i used (int*) and (unsigned long*).
@Arunsharma-tf5xp
@Arunsharma-tf5xp 5 жыл бұрын
Why he hadn't use "*" inside that void swap function in as memcopy(*vp1, *vp1, size) because writing just vp1 return it's address not it's value that it is actually pointing 🙄
@aayushchhabra7465
@aayushchhabra7465 5 жыл бұрын
That is due to the specification of memcpy function. memcpy explicitly expects you to pass the locations of destination and source without dereferencing it.
@bobesfanchi
@bobesfanchi 4 жыл бұрын
You can't derefrence a void pointer. C++ needs to know the size of the pointer to be able to deref it.
@DeBaimbo
@DeBaimbo 12 жыл бұрын
Is there a book that treats exactly these subjects? I like listening to this professor, but I feel more comfortable studying on a book.
@AnkurSharma-je1ro
@AnkurSharma-je1ro 4 жыл бұрын
Computer science: A Programmer's perspective
@DeBaimbo
@DeBaimbo 4 жыл бұрын
@@AnkurSharma-je1ro Thanks!
@linosnoto
@linosnoto 12 жыл бұрын
where can i find the assignments
@danielgray8053
@danielgray8053 2 жыл бұрын
did you find them?
@ncmathsadist
@ncmathsadist 8 жыл бұрын
the bad swap near 51:00 gave me a "bus error 10."
@666friends
@666friends 14 жыл бұрын
@NameNotaNumber A good programmer knows at least one language from the different programming types.
@Kikeron
@Kikeron 12 жыл бұрын
He says afterwards "It’s incidentally normal math with char *s because characters are 1-byte wide, so the scaling factor is just 1, okay?"
@bishalthapa4639
@bishalthapa4639 7 жыл бұрын
That's heavy :)
@SuperGanga2010
@SuperGanga2010 13 жыл бұрын
@dimipeli Yeah, he does. But sometimes students' questions aren't well-formed and understandable, so as soon as the lecture is being filmed, he has no time for such things. Would you like to see how he tries to understand students' questions for 1 minute or so instead of telling new information? I wouldn't.
@jakefund6728
@jakefund6728 10 жыл бұрын
Trying to run project 2 - Segmentation fault =(
@ductran5913
@ductran5913 10 жыл бұрын
I got seg fault 11 when run imdb-test. Any one help please :)
@flyaloy1
@flyaloy1 8 жыл бұрын
this happens when you try to access to a memory reference that doesn't belong to your program, maybe your pointer is out of range of something like that.
@matthewsmeets
@matthewsmeets 5 жыл бұрын
@@flyaloy1 Correct, try allocating some random local variables around your code so you have a bigger heap to work with.
@jamesedmonds6814
@jamesedmonds6814 11 жыл бұрын
he says it in the video more than once.
@YoungYSL
@YoungYSL 11 жыл бұрын
Well I can't understand why audience is so dissatisfied. I don't know wether it is normal in USA, maybe cause I am from Ukraine. Here we have absolutely different type of interaction between class and lecturer. P.S. Lecturer does his work in a great way, really miss such lecturers in UA
@aajr95
@aajr95 11 жыл бұрын
thats because its over all of their heads
@invalidacess
@invalidacess 16 жыл бұрын
lol so true lol... i notice that the views keep getting smaller and smaller as u go from lecture 1 - 4 lol wonder y?
@AnkurSharma-je1ro
@AnkurSharma-je1ro 4 жыл бұрын
Thats is surfing vs following
@Grundalizer
@Grundalizer 14 жыл бұрын
I do not get programming at all.
@rhshriva
@rhshriva 15 жыл бұрын
bible of C
@dimipeli
@dimipeli 14 жыл бұрын
He makes some mistakes here and there, and misinterprets some of the students' questions, but he is still a good lecturer.
@rrook88
@rrook88 6 жыл бұрын
look like beggining of mem fragmentation.. solution. buy defrag software
@acho8387
@acho8387 Жыл бұрын
Am I the only one getting super distracted by this "does that make sense" every other sentence? It really breaks my focus..
@yeors
@yeors 12 жыл бұрын
make sense?? XD jajajajajajajajaja
@ZainaWalkingTheLine
@ZainaWalkingTheLine 12 жыл бұрын
Hahahahha wt language is that?!! :$
@Maisonier
@Maisonier 5 жыл бұрын
english
Lecture 5 | Programming Paradigms (Stanford)
52:16
Stanford
Рет қаралды 139 М.
21. Chaos and Reductionism
1:37:33
Stanford
Рет қаралды 1,7 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 11 МЛН
Ничего не делаю всё видео 😴
00:33
Miracle
Рет қаралды 744 М.
LIFEHACK😳 Rate our backpacks 1-10 😜🔥🎒
00:13
Diana Belitskay
Рет қаралды 3,6 МЛН
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 990 М.
4. Assembly Language & Computer Architecture
1:17:35
MIT OpenCourseWare
Рет қаралды 713 М.
you will never ask about pointers again after watching this video
8:03
FREEDOM of LESS: One Man's Minimalist Journey
15:49
Reflections of Life
Рет қаралды 163 М.
Is Computer Science still worth it?
20:08
NeetCodeIO
Рет қаралды 238 М.
Birth of BASIC
38:13
Dartmouth
Рет қаралды 1,2 МЛН
Just enough assembly to blow your mind
29:31
Kay Lack
Рет қаралды 56 М.
Bjarne Stroustrup: C++ | Lex Fridman Podcast #48
1:47:13
Lex Fridman
Рет қаралды 1 МЛН
Object Oriented Programming vs Functional Programming
18:55
Continuous Delivery
Рет қаралды 755 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 395 М.
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 11 МЛН