#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
🔥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
#include
int main() {
// Write C code here
double salary = 25000;
double* ptr=&salary;
printf("adress:%p
",ptr);
printf(" value :%.2lf",*ptr*2);
return 0;
}
Answer : Option C (*p = a)
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
This is most cohesive explanation of pointers I've seen online. Thank you!
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
Hats off for this wonderful explanation on the topic Pointers which I so badly wanted to know how it works. Thank you
thank you so much, i was unable to understand my baugette eating teacher explaining this.
THANK YOU, YOU SAVED MY LIFE.
Nice and simple introductory tutorial to pointers.👍
Thanks u so much mam , your way of explanation was awesome 👌 and i just learned pointer very easily
#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.
your app is really good with that style of interface and layout 👍
Very helpful. Thank you.
Tq so much 🙏🙏❤️❤️
Very well explained 🙏🙏❤️❤️
Very informative. Best tutorial for beginners! Waiting for more videos!!👍
Hlo anuska where are you from?
Very clear !! Thanks
very awesome video very very enlightening ❤❤❤❤❤❤❤❤🙏
You are doing a good work
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);
}
Is so much better thx !!!
so pure mam.... A lot of Respect For u
thanks, this is helpful 😊
Great explanation!
Lovely video.
Excellent Explanattion
thank u so much it really healful .tqs alot.
hey would really hope to see a code to calculate CGPA
its helping me a lot
Thank you!
amazing teacher😍😍
Crystal clear
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);
}
Great !
Thank you
nice video
Thanks
love this
Great
I need to route this to memory
Thank you for the app
Thnx
I am in need of help abt the exercise given
thank u
thanks
#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;
}
Learning this before my final rahh
perfect
nice
tankis madam
Your soft's cool btw
c is right.
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
I didn't know there is a app, that's good for mw
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
❤️❤️❤️❤️❤️
#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;
}
Option (c) is correct.
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
c is the correct answer i guess
❤❤❤❤
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.
I end up over stimulating myself
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.
English में तो सब study करवाते है हिंदी में भी करवा दीजिये,, हम हिंदी मीडियम लोग भी programing करना चाहते है
Tumse na ho payega, tum bhais charao.
Option C is d right answer
#include
int main()
{
double salary = 5000.00;
double* s_pointer = &salary;
*s_pointer *= 2;
printf("%.2f", salary);
return 0;
}
double salary = 39.500;
double* ptr;
ptr = &salary;
printf("The salary is %.3lf
", *ptr);
salary = 50.000;
printf("The new salary is %.3lf", *ptr);
c is option
Ur so brown
Option c
Option: c
Great instructions
#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
10:45 (C) *p = a
opt 3
Chats up
the correct option is C
jay Nepal
double salary;
double*psalary=&salary;
scanf("%lf",&salary);
printf("%.1lf
",*psalary);
printf("%.1lf
",*psalary*2);
Quiz answer is C
B and c
Option b
ua-cam.com/video/KGhacRRMnDw/v-deo.html
c
Answer is C
C
The answer is C. *p = a
#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;
}
Yews
*p = 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;
}
8:13 8:15 8:32
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;
}
Very confusing sorry
a
Option c is correct
0
madam badi cute h pr
The answer to the quiz is D
Free Palestine 🇵🇸
#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;
#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;
}