#23 C Pointers | C Programming For Beginners

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 194

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

    🚀 Loved the tutorial? Take it further with Programiz PRO!
    Refine your skills, conquer coding fears, and build confidence with interactive lessons, quizzes, and challenges. Strengthen your programming foundation and master C today!
    👉Start Here: bit.ly/c-master

    • @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;
      }

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

    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

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

      Thank you team Programiz I understand so much now that I’m going through these tutorials

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

    Answer : Option C (*p = a)

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

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

  • @nihatdonmzov4166
    @nihatdonmzov4166 Рік тому +17

    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);
    }

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

      it should be double* var = salary; and *var =2*var;

    • @yashjewdhun7689
      @yashjewdhun7689 22 дні тому

      @@gamerxx6344 no

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

    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

  • @shuvadeepsil2513
    @shuvadeepsil2513 4 місяці тому +2

    I was totally confused while learning pointers in C. Other UA-cam videos on this topic were not easy and comprehensive enough for me to understand. After watching this video all of my doubts regarding pointers were cleared. Thank You Programiz!!! ❤

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

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

  • @user-nt4nm4fb3u
    @user-nt4nm4fb3u 10 місяців тому +2

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

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

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

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

    #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 5 місяців тому +1

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

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

    Nice explanation didi. Balla clearly bujey. Thank you

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

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

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

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

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

    Is so much better thx !!!

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

    #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;
    }

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

    thanks, this is helpful 😊

  • @BigSmoke-r9w
    @BigSmoke-r9w 4 місяці тому

    Great explanation! You have a new subscriber! Thank you!!

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

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

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

    You are doing a good work

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

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

  • @MHJ-93
    @MHJ-93 Рік тому

    Nice and simple introductory tutorial to pointers.👍

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

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

  • @PedroLopes-k5f
    @PedroLopes-k5f Рік тому

    #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;
    }

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

    Great explanation!

  • @Aspire-ml4nr
    @Aspire-ml4nr 5 місяців тому

    #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;
    }

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

    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);
    }

  • @countrysideshowyaigrock4689

    #include
    int main() {
    double salary;
    double* pointer;
    printf("Enter your salary: ");
    scanf("%lf", &salary);
    pointer = &salary;
    printf("%.1lf", *pointer);
    *pointer = 2 * *pointer;
    printf("
    %.1lf", *pointer);
    return 0;
    }

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

    amazing teacher😍😍

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

    Excellent Explanattion

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

    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 2 роки тому +3

      A is right

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

      It's C because '*' Indicates the value of p which is equal to the value of 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;
    }

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

    Lovely video.

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

    Very clear !! Thanks

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

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

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

    really good stuff!!!

  • @linbz2784
    @linbz2784 4 місяці тому

    its helping me a lot

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

    Very helpful. Thank you.

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

    Learning this before my final rahh

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

    nice video

  • @Ech-chatouiMohammed
    @Ech-chatouiMohammed 2 місяці тому

    merci beaucoup

  • @CarolMccann-xg9zi
    @CarolMccann-xg9zi 6 місяців тому

    Thank you!

  • @shireldadon-l2t
    @shireldadon-l2t 8 місяців тому

    #include
    int main(void) {
    double salary;
    printf("please enter salary
    ");
    scanf("%lf", &salary);
    double* ptr = &salary;
    printf("value of salary is %.2lf
    ", *ptr);
    *ptr = 2 * *ptr;
    printf("new salary is %.2lf", *ptr);
    return 0;
    }

  • @kalu-kelechi-kalu
    @kalu-kelechi-kalu Рік тому

    Crystal clear

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

    I need to route this to memory

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

    c is right.

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

    thank u so much it really healful .tqs alot.

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

    Great !

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

    Thank you

  • @Ech-chatouiMohammed
    @Ech-chatouiMohammed 2 місяці тому

    c'est très utile

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

    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;
    }

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

    #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

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

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

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

    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

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

    Thnx

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

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

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

    thanks

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

    perfect

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

    Great

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

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

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

    tankis madam

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

    love this

  • @JeongWoonKim-i4j
    @JeongWoonKim-i4j Рік тому

    #include
    int main() {
    double salary;
    double* ptr;
    printf("Enter the salary: ");
    scanf("%lf", &salary);
    ptr = &salary;
    printf("Last salary: %.2lf
    ", *ptr);
    *ptr = *ptr * 2;
    printf("New salary: %.2lf", *ptr);
    return 0;

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

    10:45 (C) *p = a

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

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

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

    /*
    Program to change value of a variable using pointer.
    Instructions: Get input value for a double variable named salary, Assign
    the address of salary to a double pointer.
    Use pointer to print value of salary, increase salary by 2 times and print new salary.
    */
    #include
    int main()
    {
    double salary;
    printf("Enter Salary: ");
    scanf("%lf", &salary);

    double* ptr = &salary;
    printf("Salary = %.1lf
    ", *ptr);
    *ptr = salary * 2;
    printf("Salary doubled = %.1lf", *ptr);

    return 0;
    }

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

      seems correct to me atleast

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

      Could have given salary in the last printf() as the value is already changed

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

    Thank you for the app

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

    #include
    int main(/*the answer is C*/){
    double salary;
    printf("enter your salary: ");
    scanf("%lf", &salary);
    double* ptr = &salary;
    printf("%.2lf
    ", *ptr);
    *ptr *= 2;
    printf("your new salary is %.2lf", *ptr);
    }

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

    thank u

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

    Your soft's cool btw

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

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

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

    Option C

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

    c is the correct answer i guess

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

    nice

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

    I am in need of help abt the exercise given

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

    hey would really hope to see a code to calculate CGPA

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

    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

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

    Option (c) is correct.

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

    Option: c

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

      Great instructions

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

    c is option

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

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

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

    the correct option is C

  • @054vijayakumark4
    @054vijayakumark4 2 роки тому

    ❤️❤️❤️❤️❤️

  • @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 6 місяців тому

      @@abdulmateenalabi6063 will get address

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

      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.

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

    I end up over stimulating myself

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

    Option C is d right answer

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

    Quiz answer is C

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

    jay Nepal

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

    Option c

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

    Option b

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

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

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

    Answer is C

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

    opt 3

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

    #include
    #include
    int main ()
    {
    double salary= 350.57;
    double* ptr=&salary;
    *ptr=salary*2;
    printf("NEW SALARY: %.2lf",salary);
    return 0;
    }

  • @light-warrior
    @light-warrior 10 місяців тому

    TASK:
    #include
    int main() {
    double salary;
    printf("Enter your monthly salary: ");
    scanf("
    %lf", &salary);
    double* ptr = &salary; //assigning the adress of salary to the double pointer
    *ptr = salary; //assigning the value of the salary to the value stored in the pointer
    printf("
    Your salary before change: % lf", *ptr);
    *ptr = 2 * salary;
    printf("
    Your new salary after the salary increase: %lf", *ptr);
    return 0;
    }
    C is the correct option because *p shows us the value stored in pointer and a is also showing us the value of the variable.

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

    use dark mode 😭😭😭

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

    B and c

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

    The answer is C. *p = a

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

    #include
    #include
    // c pointers
    int main() {
    // Create a program to change the value of a variable using a pointer.
    // * Get input value for a double variable salary.
    // * Assign the address of salary to a double pointer.
    // Now use pointer to
    // * Print the value of salary.
    // * Increase the salary by 2 times.
    // * Print the new salary.
    double salary;
    double* ptr;
    printf("Enter Salary: ");
    scanf("%lf", &salary);
    ptr = &salary;
    printf("Salary is: %.1lf", *ptr);
    double inc = *ptr * 2;
    printf("
    Increased Salary: %.2lf", inc);
    }

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

    Chats up