🚀 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
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.
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); }
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!!! ❤
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); }
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
/* 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);
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
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.
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.
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.
#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); }
🚀 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
#include
int main() {
// Write C code here
double salary = 25000;
double* ptr=&salary;
printf("adress:%p
",ptr);
printf(" value :%.2lf",*ptr*2);
return 0;
}
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.
Same - For some reason seeing the memory location printed on screen made a light bulb go off for me
Thank you team Programiz I understand so much now that I’m going through these tutorials
Answer : Option C (*p = a)
Correcto!
This is most cohesive explanation of pointers I've seen online. Thank you!
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);
}
it should be double* var = salary; and *var =2*var;
@@gamerxx6344 no
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
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!!! ❤
thank you so much, i was unable to understand my baugette eating teacher explaining this.
THANK YOU, YOU SAVED MY LIFE.
Hats off for this wonderful explanation on the topic Pointers which I so badly wanted to know how it works. Thank you
Very informative. Best tutorial for beginners! Waiting for more videos!!👍
Hlo anuska where are you from?
#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;
}
Why make a Newsalary variable? The scope is to change the initial value through the pointer.
Nice explanation didi. Balla clearly bujey. Thank you
Tq so much 🙏🙏❤️❤️
Very well explained 🙏🙏❤️❤️
so pure mam.... A lot of Respect For u
Is so much better thx !!!
#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;
}
thanks, this is helpful 😊
Great explanation! You have a new subscriber! Thank you!!
#include
int main()
{
double salary = 5000.00;
double* s_pointer = &salary;
*s_pointer *= 2;
printf("%.2f", salary);
return 0;
}
You are doing a good work
Thanks u so much mam , your way of explanation was awesome 👌 and i just learned pointer very easily
Nice and simple introductory tutorial to pointers.👍
your app is really good with that style of interface and layout 👍
#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;
}
Great explanation!
#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;
}
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);
}
#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;
}
amazing teacher😍😍
Excellent Explanattion
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
D
I belive it's option D , where p is the variable and *a is the address to that variable(my guess)
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".
A is right
It's C because '*' Indicates the value of p which is equal to the value of a
#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;
}
Lovely video.
Very clear !! Thanks
very awesome video very very enlightening ❤❤❤❤❤❤❤❤🙏
really good stuff!!!
its helping me a lot
Very helpful. Thank you.
Learning this before my final rahh
nice video
merci beaucoup
Thank you!
#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;
}
Crystal clear
I need to route this to memory
c is right.
thank u so much it really healful .tqs alot.
Great !
Thank you
c'est très utile
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;
}
#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
#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;
}
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
Thnx
#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;
}
thanks
perfect
Great
double salary = 39.500;
double* ptr;
ptr = &salary;
printf("The salary is %.3lf
", *ptr);
salary = 50.000;
printf("The new salary is %.3lf", *ptr);
tankis madam
love this
#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;
10:45 (C) *p = a
double salary;
double*psalary=&salary;
scanf("%lf",&salary);
printf("%.1lf
",*psalary);
printf("%.1lf
",*psalary*2);
/*
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;
}
seems correct to me atleast
Could have given salary in the last printf() as the value is already changed
Thank you for the app
#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);
}
thank u
Your soft's cool btw
I didn't know there is a app, that's good for mw
Option C
c is the correct answer i guess
nice
I am in need of help abt the exercise given
hey would really hope to see a code to calculate CGPA
thanks for your explanation but what is the best way to learn c programming?
practice leetcode daily bro
Practice
there will be no error coming by using *ptr instead of * ptr, she write %d that why the value came instead of address
Yeah, you're correct
Option (c) is correct.
Option: c
Great instructions
c is option
Ur so brown
English में तो सब study करवाते है हिंदी में भी करवा दीजिये,, हम हिंदी मीडियम लोग भी programing करना चाहते है
Tumse na ho payega, tum bhais charao.
the correct option is C
❤️❤️❤️❤️❤️
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
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.
@@abdulmateenalabi6063 will get address
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.
I end up over stimulating myself
Option C is d right answer
Quiz answer is C
jay Nepal
Option c
Option b
ua-cam.com/video/KGhacRRMnDw/v-deo.html
Answer is C
opt 3
#include
#include
int main ()
{
double salary= 350.57;
double* ptr=&salary;
*ptr=salary*2;
printf("NEW SALARY: %.2lf",salary);
return 0;
}
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.
use dark mode 😭😭😭
B and c
The answer is C. *p = a
#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);
}
Chats up