Pointers in C for Absolute Beginners - Full Course

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2024
  • Finally understand pointers in C in this course for absolute beginners. Pointers are variables that store the memory address of another variable. They "point" to the location of data in memory. With a bunch of examples, this course demystifies pointers and their various uses, covering topics such as passing by reference vs. value, void pointers, arrays, and more.
    ✏️ Course created by ‪@onaecO‬
    ⭐️ Contents ⭐️
    (0:00:00) Introduction
    (0:00:39) What is a computer eli5 CPU, RAM, bytes
    (0:08:04) Data Types
    (0:13:31) Intro to processes
    (0:16:44) process memory layout
    (0:19:17) Variables in memory
    (0:23:01) Naive change_value program
    (0:28:05) Change_value with pointers
    (0:33:03) The classic swap
    (0:34:05) Why declaration and dereference have the same syntax for pointers?
    (0:38:39) Advantages of passing by reference va passing by value
    (0:45:26) Why do pointers to different data types have the same size?
    (0:47:49) Given that pointers have all the same size, why do we need a pointer type?
    (0:58:16) void pointers are confusing
    (1:00:14) why malloc is handy and more on void*
    (1:09:09) Are arrays just pointers?
    (1:25:00) Array Decay into a pointer
    (1:32:59) why array decay is useful?
    (1:37:49) arr[5] == 5[arr]
    (1:39:04) pointers to pointers: **argv
    (1:47:11) *argv[] or **argv?
    (1:52:41) pointer to functions
    (1:59:02) use case with pointers to functions
    🎉 Thanks to our Champion and Sponsor supporters:
    👾 davthecoder
    👾 jedi-or-sith
    👾 南宮千影
    👾 Agustín Kussrow
    👾 Nattira Maneerat
    👾 Heather Wcislo
    👾 Serhiy Kalinets
    👾 Justin Hual
    👾 Otis Morgan
    --
    Learn to code for free and get a developer job: www.freecodecamp.org
    Read hundreds of articles on programming: freecodecamp.org/news

ความคิดเห็น • 175

  • @juanmanuelfuentes314
    @juanmanuelfuentes314 ปีที่แล้ว +28

    As a computer science engineer I can see how understanding pointers pavement you to understand the underneath meaning of variables, arrays and complex structures. That's something that we all are forgetting with 'modern' languages.

    • @sarahyukino7213
      @sarahyukino7213 ปีที่แล้ว +2

      I learned about 'pointers' with rust, don't know if it's the same thing with C

    • @Aryan_Divyanshu_000
      @Aryan_Divyanshu_000 11 หลายเดือนก่อน

      Interesting

    • @joshuaketor
      @joshuaketor 8 หลายเดือนก่อน

      Very true

  • @rowancode
    @rowancode ปีที่แล้ว +61

    I just started learning C/C++ and this gets dropped, definitely you guys are amazing, thank you for the course! This is really helpful

    • @UToobUsername01
      @UToobUsername01 ปีที่แล้ว

      I used to learn C and it got me back into wanting to re-learn all of the stuff I forgot. I think I have many "learn how to code in C" books lying around but I ended up stopping right about the part where it got into pointers. lol

    • @nkazimulojudgement3583
      @nkazimulojudgement3583 ปีที่แล้ว

      @@UToobUsername01 you dont work with C anymore?

    • @beepbeepgamer1305
      @beepbeepgamer1305 7 หลายเดือนก่อน

      are you still learning c? I just started learning c since there's an paper for c in my clg. C is tough ngl, how is it going on for you?

    • @armincal9834
      @armincal9834 6 หลายเดือนก่อน

      ​@beepbeepgamer1305 imo c is actually the easiest language there is,but because it's so simple,writing anything more complicated than a text manipulation program is a pain because the language almost doesn't do anything for you

  • @874D8
    @874D8 10 หลายเดือนก่อน +7

    I loved it! I sat down and typed the whole thing and every exercise and this helped a lot. The explanations and examples are really good, I learned a lot even if I thought I was not a total beginner. :)

  • @meuhch
    @meuhch 11 หลายเดือนก่อน +1

    Amazing video, with extremely clear explanations of what pointers are and how to use them. Thank you very much!

  • @eduardof.vicentini9225
    @eduardof.vicentini9225 10 หลายเดือนก่อน +1

    Great class! Just finished it, pointers explained with mastery, thanks!

  • @buddikagunawardena2200
    @buddikagunawardena2200 ปีที่แล้ว +28

    The first 40 minutes was all it took for me to understand this concept of pointers clearly.
    Great Tutorial!

    • @Abdallah..................
      @Abdallah.................. 3 หลายเดือนก่อน

      The same. I understand this concept after watching the first 40 minutes of the video

  • @onaecO
    @onaecO ปีที่แล้ว +65

    All the Code used and few notes here:
    medium.com/@jalal92/just-dereference-the-link-for-the-code-in-the-video-cdfc0c2d9547
    I learnt myself a lot with freeCodeCamp and now, crazy enough, i produce myself tutorials!
    I will always be a promoter of this amazing project, empowering people for free all over the world.
    A particular mention to Beau that allowed me to be part of this, such a gentleman! ❤

  • @minimalSwift
    @minimalSwift 9 หลายเดือนก่อน +4

    This is just the best course about pointers that I found online! 😀

  • @diegoignacioantonioquintan6153
    @diegoignacioantonioquintan6153 10 หลายเดือนก่อน

    Awesome masterclass! Really well explained and very comprehensive, thx for this content!!

  • @kevincodes674
    @kevincodes674 11 หลายเดือนก่อน

    Brilliant, very well explained. Thank you for sharing your insight.

  • @gabrielgomesmabiala6707
    @gabrielgomesmabiala6707 ปีที่แล้ว +13

    C is a classic language never get old evergreen thank you once more FFC

    • @SS-jq6mh
      @SS-jq6mh ปีที่แล้ว +10

      FreeFodeCamp

    • @iGhostr
      @iGhostr ปีที่แล้ว +1

      @@SS-jq6mhlmao 💀

  • @CarCinCal
    @CarCinCal 7 หลายเดือนก่อน +2

    So anyway this is the best C Tutorial on TH-cam…. Well Done!!! 👏🏽 👏🏽 👏🏽

  • @tvxlc
    @tvxlc ปีที่แล้ว

    Interesting and informative video to watch - thank you very much!

  • @blackguardian89
    @blackguardian89 ปีที่แล้ว +1

    Thank you for the amazing lecture!

  • @AndersonSilva-dg4mg
    @AndersonSilva-dg4mg ปีที่แล้ว +4

    Hooray! Thanks for lession.

  • @Naoty_san
    @Naoty_san 6 หลายเดือนก่อน

    wow, it makes me understand things! Thank you!

  • @arduinoguru7233
    @arduinoguru7233 6 หลายเดือนก่อน

    one of the best videos so far.

  • @Abdallah..................
    @Abdallah.................. 3 หลายเดือนก่อน

    I have just watched this video. And I would tell you that you got a new follower.
    Such a great video.
    Also the site you mention to visualize how pointers work.
    I really advice people to watch this video and to be patient.
    According to me. I understand the whole idea about pointers by the first 40 minutes.

  • @slowcoding
    @slowcoding 2 หลายเดือนก่อน

    Wow! Running the program at the visualization site, we can visually see how the pointer is working. Great! Thank you for the insightful lecture.

  • @adsfwef1331
    @adsfwef1331 11 หลายเดือนก่อน +1

    This is very helpful thanks.

  • @AwaisFarooqi-dy1cp
    @AwaisFarooqi-dy1cp ปีที่แล้ว +2

    This help students alot because pointers is difficult for students in programming

  • @rensukiyo
    @rensukiyo ปีที่แล้ว +16

    1/2
    Some key notes (not detailed and please correct my understanding where necessary):
    The main function is BOOM the big bang of the program where the code starts executing. This function sets off a chain of calls and returns from other functions. Nice diagram at 16:24
    Naive change_value program (code at 23:02)
    -nb is an int variable set to 42. the nb variable is passed to the change_value function. Within the change_value function, nb is set to 1337. Now in the main function, nb is printed. What will the value of nb be?
    - The answer is nb will still have the value of 42. Why? This is because the variable nb is passed by value and not by reference. Basically a copy of the variable is passed to the change_value function rather than the memory address where the variable is stored. This means that change_value changes the value of a copy of nb to 1337 rather than the original nb variable.
    change_value program with pointers (code at 32:45)
    -So how would you change the original nb variable?
    -The answer is to pass a direct reference to the nb variable address AKA a pointer!
    -The code is changed such that change_value's parameter is a pointer (designated with asterisk (*) before variable name), the variable name is changed to foobar
    -*foobar is assigned the value of 1337 (The variable stored at the foobar pointer is assigned 1337) (foobar refers to the pointer that stores the address while *foobar refers to the variable stored at this address; referring to the variable stored at the address is called dereferencing)
    -Instead of creating an nb pointer in the main function the nb address can be passed directly as &nb
    -Now nb is successfully changed to 1337! We are dealing with the same nb variable stored in the same memory location rather than a copy of the nb variable!
    Classic Swap (code at 33:40)
    -a is an int variable assigned 42. b is an int variable assigned 1337. swap is a function that will switch these values using pointers. First, the addresses of a and b are passed to swap as parameters.
    -In the swap function, a is referred as n and b is referred as n1 (based on order when swap is called).
    -To swap the values, the int variable tmp is created to temporarily store n's value. n is then assigned n1s value. Finally, n1 is assigned n's original value.
    -Line 7 n is dereferenced, Line 8 n and n1 are dereferenced, Line 9n1 is dereferenced. Dereferencing simply means dealing with variables rather than the memory locations where variables are stored
    Why declaration and dereference have the same syntax? (34:05)
    -Worth watching this section, it is concise
    The main benefit of passing by reference is that you don't need to make a copy and therefore you save memory especially if you are passing something large like a large array
    Pointers have the same size for different data types, an analogy for this is that the empire state building address and a small restaurant's address are the same size, even though the size of the buildings are different
    If pointers are the same size, why do pointer types have to be specified? (pointer type = type of variable achieved by dereferencing pointer)
    Basically, different different data types are stored differently in a way that impacts pointer functionality. chars take up 1 byte, ints take up 4 bytes. (One memory address correlates to one byte)
    One example of how functionality is changed is pointer arithmetic:
    if pc is a char pointer (chars are 1 byte, a memory address holds 1 byte), and pc refers to the memory address 0x7ffeea5f930, pc + 1 would refer to 0x7ffeea5f931, pc + 2 would refer to 0x7ffeea5f932
    if ptr is an int pointer (ints are 4 bytes, a memory address holds 1 byte), and ptr refers to the memory address 0x7ffeea5f930, pc + 1 would refer to 0x7ffeea5f934, ptr + 2 would refer to 0x7ffeea5f938
    Pointers can be type casted (the pointer type is changed) line 13 in code at (50:57) which changes how the compiler interprets the variable stored in the pointer. Basically the pointer can act like the variable it is associated with is of a different type, while the actual variable is unchanged. I know this is confusing, please call me out if I am wrong about anything.
    As stem cells can become any cell type, or actors can be assigned any role, void pointers can later be assigned a data type.

  • @sukivirus
    @sukivirus ปีที่แล้ว

    Love C and C++. Instant like and love to the video

  • @Anduuu077
    @Anduuu077 3 หลายเดือนก่อน +1

    Very good tutorial. Could say it's the best on the market and it's free. Would gladly donate

  • @guillermoezequielperna9674
    @guillermoezequielperna9674 4 หลายเดือนก่อน

    Thank you very much for this content!

  • @Vazzible_gaming
    @Vazzible_gaming 3 หลายเดือนก่อน

    Really good at explaining memory, like a professor

  • @dace9294
    @dace9294 5 หลายเดือนก่อน +2

    I appreciate your work thank you so much for your video

  • @MarcusHCrawford
    @MarcusHCrawford ปีที่แล้ว +3

    I don’t understand how you guys always know what I’m Googling.

    • @techdoctorP
      @techdoctorP ปีที่แล้ว

      Brooooooooo.... It's wild..

    • @rusi6219
      @rusi6219 6 หลายเดือนก่อน

      They're in your walls

  • @giacomo1439
    @giacomo1439 8 หลายเดือนก่อน +1

    Saved the video for first year at university

  • @Tusharmanchanda-uz8xp
    @Tusharmanchanda-uz8xp ปีที่แล้ว +1

    Great tutorial

  • @NobleAbsinthe
    @NobleAbsinthe 8 หลายเดือนก่อน +4

    I’m at 30 mins so far. So basically we just have to use the & sign when we pass variables in as arguments, and in our functions we use * to declare a pointer and deref inside the function. This way we can actually change the value of our original variable. Is that right?

  • @caffe2285
    @caffe2285 ปีที่แล้ว +3

    It's rather useful to rewind the video if you do not understand. A random passerby

  • @sairajdas6692
    @sairajdas6692 11 หลายเดือนก่อน +1

    Brilliant video. Also subbed and clicked the bell. Waiting for your next video.

  • @anime-fights9123
    @anime-fights9123 ปีที่แล้ว +4

    Do you have a video with generic pointers and memory by increment, also data structures with generic pointers.

  • @renanlins3916
    @renanlins3916 ปีที่แล้ว +3

    You could enable close captions.

  • @yeyintaung9837
    @yeyintaung9837 ปีที่แล้ว +7

    The very topic why I left c .now I am gonna try again ❤

    • @user-bw6sr5bj7e
      @user-bw6sr5bj7e ปีที่แล้ว

      "C and assembly are great starting points in the world of programming."

    • @benjwilliams5104
      @benjwilliams5104 9 หลายเดือนก่อน

      Best of luck! You got this!

  • @IanoNjuguna
    @IanoNjuguna 11 หลายเดือนก่อน +1

    This tutorial just dropped at the right time.

  • @tesfalemeshetu4675
    @tesfalemeshetu4675 3 หลายเดือนก่อน

    Simply the best 👌

  • @rafaelojeda
    @rafaelojeda ปีที่แล้ว +1

    2 hours of lectures about pointers? Most videos are like 5 mins and I feel that they do not help at all this is great!

  • @surajkumarsingh4857
    @surajkumarsingh4857 ปีที่แล้ว +2

    Informative ❤❤❤

  • @josephaj8310
    @josephaj8310 ปีที่แล้ว +2

    We also need a handlebars(hbs) tutorial as it will be very helpful since there is no tutorial for hbs in YT.

  • @lorenne928
    @lorenne928 ปีที่แล้ว +2

    thank for these pointers, Goodç7

  • @sabuein
    @sabuein ปีที่แล้ว +2

    Thank you.

  • @Ak4n0
    @Ak4n0 ปีที่แล้ว +5

    Todavía no he visto el video pero en las explicaciones de pasar arrays a las funciones te ha faltado el caso del array de más de una dimensión, que en este caso sí hay que pasarle todas las dimensiones menso la primera a fin de que cuándo se haga uso del array dentro de la función éste sepa dónde buscar el dato. Por ejemplo:
    void (int my_array[][2], sizeof_t size) { ... }

    • @onaecO
      @onaecO ปีที่แล้ว +1

      Dear friend, you are totally right. The thing is that i thought about super beginners in this video-course. I rarely use 2D matrixes in real life, furthermore i don't wanna scare too much with too many details. This concept i'd say is for more advanced users. Here i just want to bring someone from 0 to 1 with pointers.

  • @Trick1e
    @Trick1e หลายเดือนก่อน

    Thank you, my friend =)

  • @synen
    @synen ปีที่แล้ว +1

    Best programming channel ever!

  • @ascendedbox612
    @ascendedbox612 ปีที่แล้ว +3

    Your videos have helped me so much!

    • @haniissa1990
      @haniissa1990 ปีที่แล้ว

      how his video helped you if you just watch less then 10 minutes? and the video uploaded before 11 minute?💩

    • @ascendedbox612
      @ascendedbox612 ปีที่แล้ว +2

      @@haniissa1990 I didn't watch this one? I used his python playlist. Why are you so argumentative?

  • @veorEL
    @veorEL 5 หลายเดือนก่อน +1

    At 31:25 you say everything works thanks to the power of pointers, but in the slide, the initial value is the same as the one you are changing it to ... I mean, it works like you say, but the initial value is identical to the changed value not sure why you changed it from 42 on the previous slide ... don't forget to get your slides reviewed

  • @edinetgrunhed6000
    @edinetgrunhed6000 3 หลายเดือนก่อน

    This is gold

  • @manfredbogner9799
    @manfredbogner9799 5 หลายเดือนก่อน +1

    very good

  • @abdulrhmanibrahim1127
    @abdulrhmanibrahim1127 ปีที่แล้ว +1

    Thx ❤

  • @enesbicakEEE
    @enesbicakEEE ปีที่แล้ว +1

    i have finished c exam yesterday and saw this video today :(

  • @danypell2517
    @danypell2517 ปีที่แล้ว +2

    C IS HIGHLY EFFICIENT!

  • @slowcoding
    @slowcoding 2 หลายเดือนก่อน

    감사합니다.

  • @GamerzClub420
    @GamerzClub420 8 หลายเดือนก่อน +1

    love the subtle graphics used in the explanation

  • @vicsteiner
    @vicsteiner 25 วันที่ผ่านมา

    Thanks for the video! Funny that in the compiler I have, gcc that came in my ubuntu distro, the example at around 59 minutes leads to a segmentation error, it does not print the int 42. Printing the address I see it is (nil), so it seems that when the stackframe for foo goes away the pointer is nil. I am not sure though if this happens because the compiler assigns nil to any function that tries to return an address to a local variable or else?

  • @theprince_101
    @theprince_101 ปีที่แล้ว +4

    I just spent today reading chapter 5 of K & R's C programming and this video came 😂....such a weird coincidence

    • @_powerbeard
      @_powerbeard ปีที่แล้ว +3

      Best language book and it's not even close. Although Borland Turbo C Bible was useful.

    • @CabernetKing
      @CabernetKing 4 หลายเดือนก่อน

      Idk how you got through K&R that book is absolutely atrocious

  • @anesmekhoukh
    @anesmekhoukh 11 หลายเดือนก่อน +1

    why there is turing picture in the backgroud in ide ?

  • @destinyobamwonyi8865
    @destinyobamwonyi8865 8 หลายเดือนก่อน +1

    Am I the only one curious about his vim setup. please how did you do that ?

  • @squid13579
    @squid13579 ปีที่แล้ว +4

    Long live C 🔥

  • @nocopyrightgameplaystockvi231
    @nocopyrightgameplaystockvi231 ปีที่แล้ว +101

    I almost forgot C even had pointers 😂.

  • @Andy_B.
    @Andy_B. 2 หลายเดือนก่อน

    great that it has dark background!

  • @adebiyiadekunle871
    @adebiyiadekunle871 ปีที่แล้ว +1

    I want to learn software engineering on TH-cam, can I get recommendations and scheme for this?

  • @amund8821
    @amund8821 7 หลายเดือนก่อน +1

    Grazie

  • @techdoctorP
    @techdoctorP ปีที่แล้ว +2

    Can someone please explain how he got 0100 at 1:08:45

  • @sihemmansour5303
    @sihemmansour5303 ปีที่แล้ว +1

    Good tutorial but why you don't activate subtitle cc

  • @bresent
    @bresent ปีที่แล้ว +3

    i love C

  • @wribbit
    @wribbit 3 หลายเดือนก่อน

    Thanks for the video!
    Can someone explain, at 32:47, why do we need line 3? The function change value is already present at line 14 onwards.

    • @zDoubleE23
      @zDoubleE23 3 หลายเดือนก่อน +2

      Line 3 is called a “prototype.”
      Notice that when used in main(), change_value isn’t defined until line 14. This would cause the compiler to reject the code.
      So using a prototype allows programmers to define the function before main() in order to avoid this error.
      Note that prototypes require the “;” whereas creating the function does not.

  • @user-bw6sr5bj7e
    @user-bw6sr5bj7e ปีที่แล้ว +2

    that course is something different and and an amazing course i hopefully could finish it as soon as possible and thanks freecodecamp

  • @umutaydn6184
    @umutaydn6184 11 หลายเดือนก่อน +1

    Does stack grow top to bottom or bottom to top ???? Chatgpt says that it grows from bottom to top .

    • @tesfalemeshetu4675
      @tesfalemeshetu4675 3 หลายเดือนก่อน

      Top to bottom for stacks , and bottom up for heaps

  • @hugo-garcia
    @hugo-garcia 11 หลายเดือนก่อน +2

    Can someone explain to me what is const pointers? Is very common to see functions with const pointers as input

    • @eduardof.vicentini9225
      @eduardof.vicentini9225 10 หลายเดือนก่อน

      Can we have some examples of these functions, please?

    • @hugo-garcia
      @hugo-garcia 10 หลายเดือนก่อน

      @@eduardof.vicentini9225 void func (const int* p){
      // do stuff;
      }

    • @vonderklaas
      @vonderklaas 7 หลายเดือนก่อน

      Guys, GPT is out!

    • @DenisTrebushnikov
      @DenisTrebushnikov 4 หลายเดือนก่อน

      I guess you already found the answer, however I try to explain for myself: any pointer as well as any variable has an address in memory cell, the value in the memory cell can be changed... adding word const we deny changing value. So const pointer that link to address can't be changed, you can't assign pointer a new address. (pointer on const value is the different thing - and this means, that with pointer you can't change value by address)

  • @vicsteiner
    @vicsteiner 18 วันที่ผ่านมา

    Again thanks for the video. By the end there is this example using vmmap, I understand vmmap is only for mac. Is there a similar tool I can use on a Ubuntu machine?

    • @whyal5307
      @whyal5307 9 วันที่ผ่านมา

      vim

  • @user-vd6wb5ef8v
    @user-vd6wb5ef8v ปีที่แล้ว

    The example with function change_value(int nb) at 23:03 is confusing.
    Logically one would expect change_value(nb) would chane the value of nb, because nb is declared and initiated (nb=42;) in main() (and therefor is of a global scope) and it is not re-declared within change_value(nb). Therefore nb is visible from change_value(nb).
    If. as you say, nb mentioned in change_value(nb) is a different variable, then you should get an error "nb is not declared"
    Will you explain please?

    • @em_iiy
      @em_iiy ปีที่แล้ว +3

      I think a couple things are unclear to you
      When declaring a variable in the main function, it's scope is limited to the main function.
      A global variable would be declared like this:
      int global = 42;
      int main()
      {
      printf("%d
      ", global);
      global = 1337;
      printf("%d
      ", global);
      }
      this would print out:
      42
      1337
      The other thing is that seems unclear, is that the parameters of a function also declare them as a variable, and initialize them with the value passed to the function
      this means that:
      change_value(int nb);
      int main()
      {
      change_value(42);
      }
      this creates a new integer variable called nb in the scope of the change_value function, and sets that variable to 42 (or whatever you pass through the function).
      So in the example the nb variable in the main, and the nb variable in the parameters to the change_value function are unrelated to each other they just happen to have the name
      Hopefully this clears things up a bit
      Have fun learning about pointers ;)

    • @user-vd6wb5ef8v
      @user-vd6wb5ef8v ปีที่แล้ว +1

      @@em_iiy thank you for your quick and detailed reply. It is clear with the global example. Yet I still cannot get a clean logical picture about change_value function.
      Part of the confusion is causes by (int nb) in the function declaration. Should I understand that "nb" in the function declaration and "nb" inside the function definition is just a coincidence? I.e. the function declared as change_value(int any_integer_variable_or_number) would have the same effect?
      Another confusion: both main() and change_value() are functions. Yet main() requires a variable to be declared before being assigned a value, while change_value() can assign a value to an undeclared variable. Why?

    • @em_iiy
      @em_iiy ปีที่แล้ว

      ​@@user-vd6wb5ef8v Yes you're correct that the 2 "nb" variables are coincidentally called the same name but are entirely different variables. They could've declared the function like "void change_value(int x)" and it would've done the exact same thing. my guess is that it is a setup to introduce a change_value() function that does do what you expect but by passing a pointer instead, so the confusion was likely done on purpose (I can't say this for sure as I've not actually watched the video). In case they haven't I put the code to something that would work at the end of the comment
      Your 2nd question might be a tiny bit tricky to explain but I'll try my best.
      In the change_value(int x) function, the variable "x" gets declared in the parentheses. so if you were to try and declare "x" again in change_value, like "int x = 100;" you'd be left with an error.
      This "parameter" is then immediately assigned whatever you passed to the function, be it the value a constant value or the value assigned to a variable.
      ex:
      int a;
      a = 42;
      change_value(42) // here a constant value of 42 is passed to the function
      change_value(a); // here the value held by "a" is passed to the function, which happens to be 42
      what you can imagine happening in the change_value function in both cases is:
      change_value()
      {
      int x = 42; // or whatever value you passed through
      x = 1337;
      }
      so the variable is declared, just in a slightly different way.
      Keep in mind that C tends to keep throwing you in the deep end with very low level concepts, which can be quite difficult to grasp. However these concepts become easier and easier the more you play around and just make stuff, and you'll start noticing that they give you a ton of control over whatever you're creating. They also give you insight on how a computer works in general which is very useful outside of just C. So don't worry about not getting them immediately.
      I hope what I wrote wasn't too confusing, I'm more used to explain these things verbally so this is a good exercise for me as well.
      Working change_value program:
      // function takes a pointer to an integer value
      void change_value(int *ptr)
      {
      *ptr = 1337; // the function dereferences the pointer to change the value of the variable it's pointing to
      }
      int main ()
      {
      int nb;
      nb = 42;
      printf("%d
      ", nb);
      change_value(&nb); // now passing the address of nb rather than just the value
      printf("%d
      ", nb);
      }
      done this way it should now print:
      42
      1337

  • @egecanbek9562
    @egecanbek9562 9 หลายเดือนก่อน +1

    I don't understand the joke between bit nibble and byte. 7:10 can someone explain? I am not a native speaker. What is that mean '4 bits are enabled'

    • @priyaghate522
      @priyaghate522 7 หลายเดือนก่อน +1

      when we just nibble at food when we arent that hungry.. thats called nibble and when we really feel hungry we bite the food .. thats what hes trying to say.. nibble and bite (byte) is sort of related to food analogy, i hope you understand what im trying to say :)

  • @lattehour
    @lattehour 8 หลายเดือนก่อน

    6:45 arithmetic operations (+-/* %) comparasion operations( = != ) logical operations( && ! ||)

  • @SerralheriaDicas
    @SerralheriaDicas ปีที่แล้ว +1

    O tema me interessa muito, mas o meu ingles é muito pobre - The topic interests me a lot, but my English is very poor

  • @zolambunga5582
    @zolambunga5582 6 หลายเดือนก่อน

    could you teach how you turn the gcc and ./a.out code into one function? You named it "r", how do I do that?

    • @CabernetKing
      @CabernetKing 4 หลายเดือนก่อน

      gcc example.c -o example && ./example
      The -o part stipulates what you’ll name your program instead of the default ‘a.out’

  • @rasit5820
    @rasit5820 ปีที่แล้ว +1

    Thank you for the lesson, but the fonts and shapes used in the education materials are very poor.

  • @EMAGK
    @EMAGK ปีที่แล้ว +1

    data strcture in c please

  • @akashojha4127
    @akashojha4127 ปีที่แล้ว

    First 'comments on this lecture ❤

  • @subeeradam098
    @subeeradam098 ปีที่แล้ว +1

  • @maejshbrail2233
    @maejshbrail2233 7 หลายเดือนก่อน +1

    Sadly watching this on a phone is basically impossible because of the images and color use. Guess it gottta be on a pc screen

  • @sammytiel
    @sammytiel ปีที่แล้ว +5

    Over 2 hours on just pointers? Now I know why C programmers hate them so much.

    • @_powerbeard
      @_powerbeard ปีที่แล้ว

      I never hated them, but on the Unix side we had core dumps and you could rebuild the program at point of crash.

  • @sadness2739
    @sadness2739 11 หลายเดือนก่อน

    what does that 1337.42 mean :)

  • @soumadip_skyy_banerjee
    @soumadip_skyy_banerjee ปีที่แล้ว +1

    Yes 🎉 1st

  • @hue_sane
    @hue_sane ปีที่แล้ว

    👍

  • @rezamn1362
    @rezamn1362 ปีที่แล้ว +1

    Thanks guys will you arrange a session about crack games/softwares?

  • @_powerbeard
    @_powerbeard ปีที่แล้ว +1

    Not to be contrary, but pointers and absolute beginners is going to lead to overwriting all manner of memory.
    I know, I taught new employees to code in C.
    But you gotta start somewhere. Or skip and do Rust.

    • @sarahyukino7213
      @sarahyukino7213 ปีที่แล้ว +3

      Does Rust not have pointers? I thought references and dereferences was about pointers

    • @_powerbeard
      @_powerbeard ปีที่แล้ว +3

      @@sarahyukino7213 Rust kind of has pointers but they are safe. In fact, Rust is so well designed that programs often work properly the first time you get them to compile, logic issues notwithstanding.
      Getting your code to compile can be mind bending though.
      I 100% think learning C pointers is time well spent. With function pointers and varargs, you can build polymorphic objects, and simulate an OO language. It's how C++ originally worked, it was compiled down to C (very interesting) code. Fun stuff.

    • @user-fb3mn9yv9m
      @user-fb3mn9yv9m 11 หลายเดือนก่อน +1

      As a cs student who wants to learn more about the computer systems, do u recommend c or rust?

  • @mdsohanurrahmanhridoy1343
    @mdsohanurrahmanhridoy1343 ปีที่แล้ว +1

    ❤ 1st comment

  • @RJJ-px7hm
    @RJJ-px7hm ปีที่แล้ว +1

    I know less about pointers now because of this video, very confusing.

  • @scatr1x
    @scatr1x ปีที่แล้ว

    I wait Django course

  • @zaman.tasiin
    @zaman.tasiin หลายเดือนก่อน

    38:31

  • @woosukbyun2455
    @woosukbyun2455 3 หลายเดือนก่อน

    who is the lecturer of this video??!

  • @dhaiqal._
    @dhaiqal._ 9 หลายเดือนก่อน

    anyone know how
    to run code in terminal just like that guy did ?

    • @siddhantchavan1370
      @siddhantchavan1370 8 หลายเดือนก่อน

      thats vim and he is using command for compiling, rather than pressing run on ide's like visual studio, you first compile the program and run the executable. Search on google how to compile using gcc compiler.

    • @boody8844
      @boody8844 8 หลายเดือนก่อน

      gcc code.c
      and then run
      a.exe

  • @Rahul-yu3ro
    @Rahul-yu3ro 7 หลายเดือนก่อน

    13:32

  • @seya2183
    @seya2183 9 หลายเดือนก่อน

    I'm piscine 42 ecole this moment.

  • @Naoty_san
    @Naoty_san 6 หลายเดือนก่อน

    8:04

  • @hadeseye2297
    @hadeseye2297 6 หลายเดือนก่อน

    Video by itself is great, but there's one issue. That constant squelching is quite irritating. It's a habit you can unlearn, and it will improve your speech a lot.

  • @swedishpsychopath8795
    @swedishpsychopath8795 5 หลายเดือนก่อน +1

    I'm almost sure the content in this video is wrong. Could you make a new version of the video?

    • @samoyla1
      @samoyla1 3 หลายเดือนก่อน +1

      Can you provide some arguments, why ?

    • @jc43261jc
      @jc43261jc 18 วันที่ผ่านมา

      Ok buddy

  • @adriatic123
    @adriatic123 4 หลายเดือนก่อน

    I wish the author uses emglish phrasing im a more standardized way. It would be more clear what he wanted to explain.