Introduction to Pointers | C Language Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone welcome to nourish technologies this is Ray Lewis today we are going to discuss a very important concept in a C language so that is pointers pointers in a C language the people thinking that pointers concept is a very hard so know if you are perfect in all the previous concepts such as structures arrays strings data types operators working with pointers is very easy how easy will see what is a pointer what is a pointer means just a pointer points to a memory location pointers concept is very very important without using pointers no programming language no programming language will be present in this world Weiser what is the reason the only reason is pointers use it to access the information from a memory if memory is not there and if data processing is not there accessing the data storing the data processing the data is not there then what is the use of applications and what is the use of programming languages no use so that much important simply a pointer is used to access the information of a particular memory location how can you declare a pointer variable sir so general declaration of variable general declaration of variable is just data type and followed by what is the identifier what is the identity of a variable example also will write then you will understand more clearly in teaser and here it is any variable name we are giving suppose a a so then just convert this syntax this is variable syntax we know very well just convert this into a pointer very simple just you have to add star asterisk here and this syntax also is allowed in a C language pointer a either you can place in front of the variable or you can place a followed by the data type two options these two declarations are allowed so how many types of pointers are there how many types of pointers are there only two types of pointers so what are the pointers see piped pointers second one and type pointer and type so what is a type of painter a type of pointer points to a specific type of data specific type of data this is a type of pointer for example if you take in teaser pointer it can points to only in teaser data if it is a double pointer it can points to only double data suppose if it is a struct employee pointer struct employee pointer structure pointers also we can write it can points to only employee data clearly employee data so type of pointer means a pointer always points to a specific type of data integer pointer cannot points to double data double pointer cannot points to structure data structure pointer cannot points to a functional data that is and here so what is untyped pointer can points to any type of data can points to any type of data this is also called generic pointer in a C language is called generic pointer sir what is the pointer wide pointer wide pointer is called a generic pointer that can points to any data points to any type of data that is it so these are types of pointers type a pointer and untyped pointer type of pointer always points to a specific type of data and type of pointer points to any data that is called a generic point and wide pointer so generally in pointers concept whatever the operation you do we need to take the help of two operators only two operators sir what are the two operators first one is a address operator second one is a pointer operator sir what address operator will do that we know already address operator returns the address of a particular variable address of a particular memory location of a variable that what you specified that it will return and what is the pointer variable returns pointer variable returns the value which is inside a specified address the value which is inside a specified address that will be written so that is the difference between address operator and pointer operator address and pointer operator with example will see all these things okay so one simple example main inside the main method I am declaring one integer variable I and I am initializing with the value 100 so I gets memory allocation at some location memory location is very very important whenever we are working with the pointers because pointer concept is completely based on memory locations only some location we are taking two zero four six and initial value is 100 next here it is I am declaring one unit is a pointer variable Y is our integer pointer because I want to point to integer data so type two pointer I am declaring so pointer name any name you can take suppose PTR am writing there is no strict rule that variable name should be PTR you can write your own name also no problem so PTR gets memory allocation PTR gets memory allocation at some location three double zero to just consider and here it is into PTR into pointer variable into this location I want to store address of I what is that address of i-20 for six I want to store here how to store we are taking the help of address operator I variable address i memory location address it will return that will be collected into PTR so that it is not pointing to this location with the help of that pointer memory locations over next printing printf printf % is d i am printing I value easily we can say that what is that I value 100 it will print 100 next printf % is B we are printing PTR value PTR so what is the PTR value C 2 0 4 6 it will print to 0 for 6 next printf percentage D we are printing address of I address of IV are printing what is that address of I is a 2 0 4 6 it will print to 0 for 6 printf percentage D we are printing address of PTR PTR is a location PTR location address is what 3 double 0 2 so it will print 3 double 0 2 next printf % is d pointer to PTR we are writing PTR is a 2 0 for 6 what pointer operator will return the value which is inside the specified address you specified two zero four six four PTR means four two zero four six pointer two two zero four six means the data which is inside two zero four six inside two zero four six what is the data hundred so 100 it will print and next for example printf % is d pointer to address of I what is that address of I at this operator will return the address that is two zero four six address of a user to zero four six pointer to 2 0 4 6 means once again the value which is inside that location what is the value 100 so like that we can write a pointers but remember one thing in a programming language address means is a positive integer value positive integer value but here it is a percentage D means it will print the negative values and positive values so that is why whenever we are printing addresses it is better to place % is you everywhere % is you represents only unsigned represents only unsigned and address also only positive integer value so that is why here we are placing percentage you symbol this is a simple example of how to work with the pointers concept so many concepts are there right how to work with the pointers to functions pointers to strings call by value called by reference and so many examples are there all these examples we'll see in a coming sessions for more videos please subscribe to nourish IT channel thank you
Info
Channel: Naresh i Technologies
Views: 827,107
Rating: 4.9098296 out of 5
Keywords: C Language, Pointers in C, Srinivas, Naresh IT, Hands on C Language Training, C Language Demo, Online C Language Training, C Language Tutorial Videos, C Language Overview, C Language Interview Questions
Id: sY-s7O0FiYE
Channel Id: undefined
Length: 11min 50sec (710 seconds)
Published: Mon Sep 12 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.