#23 C Pointers | C Programming For Beginners

Поділитися
Вставка
  • Опубліковано 21 лип 2024
  • #23 C Pointers | C Programming For Beginners
    In this video, we will learn about Pointers in C Programming. We will learn to work directly with computer memory addresses with the help of pointers. We will find the differences between regular variable and a pointer. Then we will learn to access and change value using pointer.
    Finally, we will make sure you won't make the common mistakes while working with pointers by guiding you the correct ways so watch this video to have clear concept on pointers.
    This video is a part of our C Programming video series: • #1: Getting Started wi...
    ~
    Resources:
    C Online Compiler: www.programiz.com/c-programmi...
    GitHub File: github.com/programiz/c-youtub...
    C (title) Tutorial (text-based tutorial): www.programiz.com/c-programmi...
    Timestamps:
    00:17 - C Pointers
    02:10 - Pointer Variables
    04:20 - Access Value using Pointers
    05:31 - Change Value using Pointers
    07:11 - Common Mistakes in Pointers
    09:58 - Programming Task
    10:43 - Quiz
    ~
    Revise your learning using our C App
    Download here for Android: bit.ly/3upaInx
    Download here for iOS: apple.co/3EZLtNq
    Find Programiz elsewhere:
    Programiz PRO: programiz.pro/
    Website: www.programiz.com
    Discord: / discord
    ~
    Facebook: / programiz
    Instagram: / _programiz
    LinkedIn: / programiz
    Twitter: / programiz
    #programiz #pointers #Programiz #pointerexample #cprogramming #learnc #programming #Cpointers #learncprogramming

КОМЕНТАРІ • 173

  • @programizstudios
    @programizstudios  2 роки тому +12

    🔥Finding it Damn Hard to Understand C Programming?
    Learn to code-the right way-with interactive lessons, quizzes & challenges. Build a strong programming base; it's IMPORTANT!
    Try Programiz PRO for Free: bit.ly/master-c-programming

    • @AbhiramDeshpande-fe1vi
      @AbhiramDeshpande-fe1vi Рік тому

      #include
      int main() {
      // Write C code here
      double salary = 25000;
      double* ptr=&salary;
      printf("adress:%p
      ",ptr);
      printf(" value :%.2lf",*ptr*2);
      return 0;
      }

  • @anonymouszn4978
    @anonymouszn4978 2 роки тому +45

    Answer : Option C (*p = a)

  • @anommaharjan3005
    @anommaharjan3005 2 роки тому +57

    I never really understood what pointer was, but my doubts and confusions were cleared out by this video. Thank you team Programiz for the wonderful and well-explained video.

    • @3dohd
      @3dohd Рік тому

      Same - For some reason seeing the memory location printed on screen made a light bulb go off for me

  • @kharlopena7512
    @kharlopena7512 Рік тому +9

    This is most cohesive explanation of pointers I've seen online. Thank you!

  • @kaseemkhan3919
    @kaseemkhan3919 2 роки тому +10

    This C programming playlist is helping me so much to learn all this concepts in very easy and adaptive manner ! Thank you programiz for this

  • @user-nt4nm4fb3u
    @user-nt4nm4fb3u 6 місяців тому +1

    Hats off for this wonderful explanation on the topic Pointers which I so badly wanted to know how it works. Thank you

  • @zeadalkssas9698
    @zeadalkssas9698 Рік тому +1

    thank you so much, i was unable to understand my baugette eating teacher explaining this.
    THANK YOU, YOU SAVED MY LIFE.

  • @malakhiwehmnikathi6629
    @malakhiwehmnikathi6629 Рік тому

    Nice and simple introductory tutorial to pointers.👍

  • @sahibaansari4450
    @sahibaansari4450 Рік тому

    Thanks u so much mam , your way of explanation was awesome 👌 and i just learned pointer very easily

  • @chinenyeumeaku9262
    @chinenyeumeaku9262 Рік тому +6

    #include
    int main() {
    double salary = 25.60;
    double* ptr = &salary;
    printf("Salary is : %.2lf", *ptr);
    double Newsalary = *ptr * 2;
    printf("
    New salary = %.2lf", Newsalary);
    return 0;
    }

    • @tibish
      @tibish Місяць тому

      Why make a Newsalary variable? The scope is to change the initial value through the pointer.

  • @orochimaru1253
    @orochimaru1253 2 роки тому

    your app is really good with that style of interface and layout 👍

  • @allthingsmoney7089
    @allthingsmoney7089 2 роки тому

    Very helpful. Thank you.

  • @shrur3527
    @shrur3527 7 місяців тому

    Tq so much 🙏🙏❤️❤️
    Very well explained 🙏🙏❤️❤️

  • @anuskasthapit7285
    @anuskasthapit7285 2 роки тому +4

    Very informative. Best tutorial for beginners! Waiting for more videos!!👍

  • @johnnytherabbit291
    @johnnytherabbit291 Рік тому

    Very clear !! Thanks

  • @prajwal_bagewadi
    @prajwal_bagewadi Рік тому

    very awesome video very very enlightening ❤❤❤❤❤❤❤❤🙏

  • @kisilujustus
    @kisilujustus 2 роки тому +2

    You are doing a good work

  • @nihatdonmzov4166
    @nihatdonmzov4166 10 місяців тому +12

    The programming task:
    #include
    int main(){
    double salary;
    printf("Enter the salary: ");
    scanf("%lf", &salary);
    double* var = &salary;
    printf("%.1lf", *var);
    *var = 2 * *var;
    printf("
    The new salary is %lf", *var);
    }

  • @armandofilho7759
    @armandofilho7759 2 роки тому +3

    Is so much better thx !!!

  • @Danyal-vt8dp
    @Danyal-vt8dp 6 місяців тому

    so pure mam.... A lot of Respect For u

  • @i-n_ph
    @i-n_ph 2 місяці тому +2

    thanks, this is helpful 😊

  • @juliusjnr_
    @juliusjnr_ Місяць тому

    Great explanation!

  • @lawrenceanekwe9318
    @lawrenceanekwe9318 Рік тому +1

    Lovely video.

  • @mohammadrezajavadi3498
    @mohammadrezajavadi3498 6 місяців тому

    Excellent Explanattion

  • @sushilgbp
    @sushilgbp Рік тому

    thank u so much it really healful .tqs alot.

  • @ssentamualvinjacob1191
    @ssentamualvinjacob1191 Рік тому

    hey would really hope to see a code to calculate CGPA

  • @linbz2784
    @linbz2784 6 днів тому

    its helping me a lot

  • @CarolMccann-xg9zi
    @CarolMccann-xg9zi Місяць тому

    Thank you!

  • @One_piece1089
    @One_piece1089 11 місяців тому

    amazing teacher😍😍

  • @Uncle-Kalu
    @Uncle-Kalu Рік тому

    Crystal clear

  • @yourgray303
    @yourgray303 9 місяців тому

    the ans is
    #include
    int main(void)
    {
    double salary;
    double* pointer = &salary;
    scanf("%lf", pointer);
    //DONT* cuse scanf puts value INTO &salary(memory address of salary), but POINTER IS ALR ADDRESS OF IT
    printf("%lf", salary);
    }

  • @interneter
    @interneter 3 місяці тому

    Great !

  • @mohammadrezajavadi3498
    @mohammadrezajavadi3498 6 місяців тому

    Thank you

  • @alameensaleem4158
    @alameensaleem4158 Рік тому +1

    nice video

  • @mohammadabdullahaalforhad1375
    @mohammadabdullahaalforhad1375 7 місяців тому +1

    Thanks

  • @morex288
    @morex288 Рік тому

    love this

  • @godswillnnachi4157
    @godswillnnachi4157 Рік тому

    Great

  • @davidbraide6647
    @davidbraide6647 Рік тому +2

    I need to route this to memory

  • @rajumalekar
    @rajumalekar 2 роки тому

    Thank you for the app

  • @Jarawain_Kharpran
    @Jarawain_Kharpran Рік тому

    Thnx

  • @NantongoLindah
    @NantongoLindah 8 місяців тому

    I am in need of help abt the exercise given

  • @sushilgbp
    @sushilgbp Рік тому

    thank u

  • @zawnaing344
    @zawnaing344 Рік тому

    thanks

  • @rainfeel_
    @rainfeel_ Рік тому +1

    #include
    int main(void)
    {
    double salary;

    printf("Enter salary : ");
    scanf("%.2lf", &salary);

    double* p = &salary;
    *p = 35;

    printf("Your salary is changed to %.2lf", salary);

    return 0;
    }

  • @bennyhuang2014
    @bennyhuang2014 2 місяці тому

    Learning this before my final rahh

  • @annapopova3221
    @annapopova3221 8 місяців тому

    perfect

  • @bryanborigas380
    @bryanborigas380 Рік тому

    nice

  • @thiagaodavez5465
    @thiagaodavez5465 Рік тому

    tankis madam

  • @andreiacampos7111
    @andreiacampos7111 Рік тому

    Your soft's cool btw

  • @sandeepyadav3766
    @sandeepyadav3766 2 роки тому +2

    c is right.

  • @jaysanga5981
    @jaysanga5981 5 місяців тому

    Answer is only c bcz *p=&a ; means dereference of p is cant store address , p=*a its wrong and *p =a; means it store value in address of what a had so address remain same but it change value in that address

  • @imveryscawed
    @imveryscawed 3 місяці тому

    I didn't know there is a app, that's good for mw

  • @karamking6404
    @karamking6404 Рік тому

    thanks for your explanation but what is the best way to learn c programming?

    • @t3bld846
      @t3bld846 Рік тому

      practice leetcode daily bro

    • @AFCOE
      @AFCOE Рік тому

      Practice

  • @sejalbansal486
    @sejalbansal486 Рік тому +2

    there will be no error coming by using *ptr instead of * ptr, she write %d that why the value came instead of address

  • @livehopeskul1157
    @livehopeskul1157 2 роки тому +1

    Option C

  • @054vijayakumark4
    @054vijayakumark4 Рік тому

    ❤️❤️❤️❤️❤️

  • @user-sv1nt8qp2h
    @user-sv1nt8qp2h 10 місяців тому

    #include

    int main (){

    double salary = 1000.23;

    double* ptr = &salary;


    *ptr = salary;

    printf("Salary = %lf", *ptr);


    salary = salary * 2;

    printf("
    Salary doubled = %lf", *ptr);

    return 0;
    }

  • @DCSDilshadAhmad
    @DCSDilshadAhmad Рік тому

    Option (c) is correct.

  • @programizstudios
    @programizstudios  2 роки тому +17

    Q. Which of the following is valid for variable a and pointer p?
    A. *p = &a
    B. p = a
    C. *p = a
    D. p = *a

    • @renuga.k7473
      @renuga.k7473 2 роки тому

      D

    • @Portagas.D.Ace75
      @Portagas.D.Ace75 2 роки тому +2

      I belive it's option D , where p is the variable and *a is the address to that variable(my guess)

    • @davidkecskes2573
      @davidkecskes2573 2 роки тому +13

      I think C...
      Because we open the location, what is stored in the pointer "p" and overwrite or upload the value with the value of variable "a".

    • @s.karthikeyan2747
      @s.karthikeyan2747 Рік тому +3

      A is right

    • @hardikbindal740
      @hardikbindal740 Рік тому +3

      It's C because '*' Indicates the value of p which is equal to the value of a

  • @lzii9127
    @lzii9127 2 роки тому +1

    c is the correct answer i guess

  • @user-iz2et4kj9y
    @user-iz2et4kj9y Рік тому

    ❤❤❤❤

  • @timothylee3105
    @timothylee3105 Рік тому

    This is a great tutorial but beginning programmers are not shown what's really going on under the hood.
    Please show how the compiler translates this C pointer syntax statement into the actual CPU instructions to demonstrate the Register Indirect addressing mode.
    Re-run the compiler with the option to generate assembly language and show the viewers the actual CPU instructions that are used to setup to read and write to RAM memory directly and indirectly.

  • @hammadraza9018
    @hammadraza9018 Місяць тому

    I end up over stimulating myself

  • @ayeshaali6462
    @ayeshaali6462 Рік тому

    I didnt understand the dufference int* ptr and int *ptr?
    int age=24;
    int* ptr=&age;
    printf("%p",&age);
    printf("
    %p",ptr);
    printf("
    value%d",*ptr); //24
    int *ptr1=&age;
    printf("
    value1 %d",*ptr1); //24
    return 0;
    it gives same result above for both syntax

    • @abdulmateenalabi6063
      @abdulmateenalabi6063 Рік тому +2

      int* ptr = &age; ----- is the correct way to do it as int* is making ptr a pointer.
      While
      int *ptr = &age ------ is wrong for pointing to the address because *ptr is to access the value of a variable and not address.
      With what you did you assigned a value variable to an address which is wrong, but since you used a value variable you will get a value instead of an address and from your last code if you try accessing your address you will not get the address.

    • @ananducs5622
      @ananducs5622 Місяць тому

      @@abdulmateenalabi6063 will get address

    • @tibish
      @tibish Місяць тому

      there is no difference from the compile's stand point. both will be seen in the same way. From a code clarity perspective there is a big difference.
      For example, if you see this line: int* ptr1, ptr2, you would tend to think that both are pointers, but you would be wrong as only ptr1 is a pointer, ptr2 is just a simple int. On the other hand if you see this line: int *ptr1, *ptr2 it is immediately clear that both ptr are pointers.

  • @deepakkushwahaji3109
    @deepakkushwahaji3109 Рік тому +1

    English में तो सब study करवाते है हिंदी में भी करवा दीजिये,, हम हिंदी मीडियम लोग भी programing करना चाहते है

  • @madhusmitamahapatra5181
    @madhusmitamahapatra5181 Рік тому

    Option C is d right answer

  • @tibish
    @tibish Місяць тому

    #include
    int main()
    {
    double salary = 5000.00;
    double* s_pointer = &salary;
    *s_pointer *= 2;
    printf("%.2f", salary);
    return 0;
    }

  • @V1ctorinos
    @V1ctorinos 10 днів тому

    double salary = 39.500;
    double* ptr;
    ptr = &salary;
    printf("The salary is %.3lf
    ", *ptr);
    salary = 50.000;
    printf("The new salary is %.3lf", *ptr);

  • @poornachandraj2417
    @poornachandraj2417 2 роки тому +3

    c is option

  • @thaaranisivakkumar7967
    @thaaranisivakkumar7967 Рік тому

    Option c

  • @vishnupriya8910
    @vishnupriya8910 Рік тому +2

    Option: c

    • @erl2nd
      @erl2nd Рік тому

      Great instructions

  • @lemichael2004
    @lemichael2004 Рік тому

    #include
    int main (){
    double *pointer ,salary,newSalary ;
    printf ("Enter your salary: ");
    scanf ("%lf",&salary);
    pointer = &salary;
    printf ("Value of salary =%.2lf",*pointer);
    newSalary = salary*2;
    pointer =&newSalary;
    printf ("
    Value of new Salary =%.2lf ",*pointer);
    return 0;

    }
    Answer of the quiz : C because *p is value , a is value so --> value =value .
    Thank you so much for your free lesson

  • @codeforcoder1
    @codeforcoder1 6 місяців тому

    10:45 (C) *p = a

  • @yogithabale
    @yogithabale 17 днів тому

    opt 3

  • @dankorwack8598
    @dankorwack8598 Рік тому +1

    Chats up

  • @innocentibeto7733
    @innocentibeto7733 Рік тому

    the correct option is C

  • @awekeningbro1207
    @awekeningbro1207 6 місяців тому

    jay Nepal

  • @kareemtawfik2886
    @kareemtawfik2886 7 місяців тому

    double salary;
    double*psalary=&salary;
    scanf("%lf",&salary);
    printf("%.1lf
    ",*psalary);
    printf("%.1lf
    ",*psalary*2);

  • @racingfan372
    @racingfan372 Рік тому

    Quiz answer is C

  • @mugumearnold6523
    @mugumearnold6523 Рік тому

    B and c

  • @ghema9515
    @ghema9515 8 місяців тому

    Option b

    • @tibish
      @tibish Місяць тому

      ua-cam.com/video/KGhacRRMnDw/v-deo.html

  • @sandamanojkumar514
    @sandamanojkumar514 Рік тому +1

    c

  • @balashebjadhav977
    @balashebjadhav977 10 місяців тому

    Answer is C

  • @dnwint2
    @dnwint2 2 місяці тому

    C

  • @albertamenyah3019
    @albertamenyah3019 11 місяців тому

    The answer is C. *p = a

  • @Aspire-ml4nr
    @Aspire-ml4nr 21 день тому

    #include
    int main () {
    double salary = 2000;
    printf("Address: %p
    ", &salary);
    double* ptr = &salary;
    printf("Value: %.2lf
    ", *ptr);
    *ptr *= 2;
    printf("Salary: %.2lf
    ", salary);
    return 0;
    }

  • @wilsonomonz299
    @wilsonomonz299 11 місяців тому

    Yews

  • @mcairstudios2205
    @mcairstudios2205 Рік тому

    *p = a

  • @freehug071
    @freehug071 Рік тому +4

    #include
    int main(void)
    {
    double salary = 250.45;
    double* ptr = &salary;
    printf("the salary is %.2lf", *ptr);
    double newsalary = *ptr * 2;
    printf("
    %.2lf", newsalary);
    return 0;
    }

  • @NantongoLindah
    @NantongoLindah 8 місяців тому

    8:13 8:15 8:32

  • @behailus-tube5024
    @behailus-tube5024 3 місяці тому

    programming task
    #include
    int main() {
    double salary = 77.5;
    printf("%p
    ", &salary);
    double* ptr = &salary;
    printf("value: %f
    ", *ptr);
    *ptr = 155;
    printf("
    %f", salary);
    return 0;
    }

  • @abhzyymm2
    @abhzyymm2 2 місяці тому +1

    Very confusing sorry

  • @kirankumarv470
    @kirankumarv470 Рік тому

    a

  • @sahibaansari4450
    @sahibaansari4450 Рік тому

    Option c is correct

  • @muhammadrizobegijonov4002
    @muhammadrizobegijonov4002 2 місяці тому

    0

  • @user-sw5cn6sf7l
    @user-sw5cn6sf7l 4 місяці тому +1

    madam badi cute h pr

  • @nihatdonmzov4166
    @nihatdonmzov4166 10 місяців тому +1

    The answer to the quiz is D

  • @abobakrabdoun9866
    @abobakrabdoun9866 Місяць тому

    Free Palestine 🇵🇸

  • @nourbensalem4199
    @nourbensalem4199 6 місяців тому

    #include
    int main() {
    double salary;
    // taking input
    printf("Enter your salary:");
    scanf("%lf",&salary);
    double* ptr=&salary;
    // working whith pointer
    printf("The old salary %lf",*ptr);
    *ptr=*ptr*2;
    printf("
    The new salary %lf",*ptr);
    return 0;

  • @vinayakpotadar4907
    @vinayakpotadar4907 Місяць тому

    #include
    int main()
    {
    double salary;
    double* ptr=&salary;
    printf("Enter your salary: ");
    scanf("%lf",&salary);
    *ptr=2*salary;
    printf("Your doubled salary is : %lf", salary);
    return 0;
    }