Added: 3 years ago
From: StanfordUniversity
Views: 57,528
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (64)

Sign In or Sign Up now to post a comment!
  • Is there a book that treats exactly these subjects? I like listening to this professor, but I feel more comfortable studying on a book.

  • where can i find the assignments

  • make sense?? XD jajajajajajajajaja

  • The quality of teachers at Stamford is just breathtaking.

  • No one is using 16 bit systems. What is pertinent is that the long type is always the word size of the machine It is very common in contemporary compilers to have int and long be the same size. Check: This is why God invented the sizeof operator.

  • @tapajara haha you fail at acting smart 16 bits is 4 bytes

  • @deathbyaccident

    There are eight bits in a byte; byte stands for By-Eight. So 16 bits is equal to 16/8 (16 by 8) bytes, which is 2 bytes. Does that make sense to people? lol :P

  • You should point out that an "int" is only 16 bits in a 16-bit system. You should be using "long" instead of "int" in your examples.

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

  • Comment removed

  • Comment removed

  • Very clear and concise. I dare say he made sense. I much agree with the C comparison to a stick shift too. On the rare occasion of driving an automatic, I find my foot wandering off to some nonexistent clutch (or parking brake) when I come to a stop. One just gets used to the control after awhile and C/C++ offers that control.

  • He makes some mistakes here and there, and misinterprets some of the students' questions, but he is still a good lecturer.

  • @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.

  • @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! :)

  • Comment removed

  • huh?

  • good teaching.

  • great tutor

  • He's good. I actually kind of more appreciate C now for the raw power it puts in the hands of programmers through all the pure bit copying and comparison operations. He actually covers some hacks, like casting to char* to do pointer arithmetic on 1 byte memory space so that normal arithmetic can be done to calculate the correct address offset. The later parts on the Fred and Wilma strings are good as well, shows how C can be abused.

  • I do not get programming at all.

  • if thats the case you shouldn't be watching this, it's fairly advanced.

  • for (int=0; i<n; i++) is NOT ANSI C!!!!!! you cannot declare a variable anywhere like in C++

  • So? Declaring counter variables inside for loops improves readability, and you should do it even if you're restricting yourself to the C subset for whatever reason (in this case, understanding low-level concepts).

  • If you have a compiler that accepts only ANSI C code, that instruction won't compile. But I'm being too picky I guess... I just wanted to point that out, b/c not many people know about that. I mean, everybody learn C and C++ toghether and think they are the same but they are absolutely not the same.

  • You can declare variables anywhere in C99, which is ANSI C.

  • @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)."

  • it should be for(int i = 0; i < n; i++) ..

    and n should be declare before.. by something

  • Comment removed

  • ...im confused T.T

  • I wonder if byte alignment would affect this? Imagine a struct:

    struct byte7 { val char[7];

    };

    And a machine which will only let you start structs at the start of 32 bit boundaries.

    Is sizeof(byte7) 7 or 8 on such a machine? If 7, what happens if I have an array of them?

  • sizeof(byte7) would be 7 I'm sure, even with an array. Although the memory allocated to storing a single byte7 or an array of byte7 would be aligned to 4 bytes. So if you had an array of 10 byte7 totalling 70 bytes, the compiler will align that to 4 bytes which will make the total allocated space 72 bytes (the extra 2 bytes being padding).

    Continued...

  • However, if you added another member to that struct the compiler will align the char array member to 8, unless specified otherwise in the compiler settings. So let's say:

    struct data

    { char str[7]; int id;

    };

    sizeof(data) is, under default compiler settings, equal to 12 because the str member has been padded with an extra byte for alignment purposes.

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

  • sure it is, you avoid the probability of making mistakes like in 13:10 -> should use sizeof(double), not sizeof(int) which is 2 times smaller on 32bit PCs

  • bible of C

  • quite clear, thanks

  • Comment removed

  • This teacher is awesome. Very concise, linear, and well thought out.  Glad he's doing this, passing on his accuracy. one of those jumbled teachers would prolly dive-bomb all these ideas into a mess (or twice as much lecture time).

  • C rocks. It's like the feeling you get from driving a stick shift....total control! I started with BASIC and Python and thought they were great because they were so easy, almost like using pseudocode. With C I feel like I'm thinking about programming properly and understanding what's going on under the hood. I think an understanding of both C and LISP is essential to becoming a good programmer.

  • C is essential, but LISP?

  • You don't need LISP in a practical sense, but learning it gives you a very valuable understanding of programming from another angle. That's why MIT always used it in their computer science classes and why the classic "Structure and Interpretation of Computer Programs" (available for download online) are taught in LISP. It's a beautiful language which will help you think about programming in a way no other language does.

  • Not any more, they're teaching SICP in Python now.. UGH!!!

  • @NameNotaNumber A good programmer knows at least one language from the different programming types.

  • he is a genius =))) from him teaching i will be the great, like he =)

  • You gotta give it to this guy, he has great chalkboard technique. Some teachers suck when it comes to writing on a board with chalk but this guy writes like he was born with a piece of chalk in his hand.

  • i will be contented to give him all my chalks :) and listen him untill i die :))

  • he says "does that make sense to people" so much it's annoying

  • very good lectures

  • Generic programming in pure C, that master is awasome, A genuine programming gettleman XD

    bravo!

  • Thank you

  • lol so true lol... i notice that the views keep getting smaller and smaller as u go from lecture 1 - 4 lol wonder y?

  • Sunday drivers.

  • yeah me too

  • This is great thank you

  • I sort of feel bad for him when he got no feedback for his "Does that makes sense to people?" questions.

  • this make me sense =))))))))) veeery makes sense =))) it is progressive :)))

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more