Basic C Programming: for Beginners by Janglu Kumar
Author:Janglu, Kumar [Janglu, Kumar]
Language: eng
Format: epub
Published: 2019-10-04T16:00:00+00:00
Using pointers
Now that you know how to declare and initialize pointers, you’re probably wondering how to use them. The indirection operator (*) comes into play again. When the * proceeds the name of a pointer, it refers to the variable pointed to.
Let’s continue with the previous example, in which the pointer p_rate has been initialized to point to the variable rate. If you write *p_rate, it refers to the variable rate. If you want to print the value of rate you could write.
Printf(“%d”, rate);
Or this
Printf(“%d”, *p_rate);
In C, these two statements are equivalent. Accessing the contents of a variable by using the variable name is called Direct access. Accessing the contents of a variable using a pointer to the variable is called indirect access or indirection.
If you have a pointer named ptr that has been initialized to point to the variable var, the following are true:
*ptr and var both refer to the contents of var (that is, whatever values the program has stored there).
Ptr and &var refer to the address of var.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hands-On GUI Application Development in Go by Andrew Williams(1545)
Unreal Engine 4 Virtual Reality Projects by Kevin Mack(1452)
Hands-On C++ Game Animation Programming by Gabor Szauer(1290)
Learn WebAssembly by Mike Rourke(1185)
Learn OpenCV 4 by Building Projects by David Millán Escrivá(1139)
Unreal Engine 4 Shaders and Effects Cookbook by Brais Brenlla Ramos(1122)
Hands-On Microservices with Rust by Denis Kolodin(1120)
C++ Concurrency in Action: Practical Multithreading by Anthony Williams(857)
C++ Data Structures and Algorithm Design Principles by John Carey Shreyans Doshi & Payas Rajan(786)
Advanced C++ by Gazihan Alankus Olena Lizina Rakesh Mane Vivek Nagarajan and Brian Price(775)
Beyond the C++ Standard Library: An Introduction to Boost by Björn Karlsson(762)
The C++ Standard Library: A Tutorial and Reference (2nd Edition) by Josuttis Nicolai M(705)
C++ All-In-One Desk Reference For Dummies by John Paul Mueller(653)
Make an Arduino-Controlled Robot by Michael Margolis(625)
C++ Crash Course by Josh Lospinoso(555)
Learning DCOM by Thai Thuan(531)
Data Structures and Algorithm Analysis in C (1st Edition) by Mark Allen Weiss(509)
UML 2.0 in a Nutshell by Dan Pilone & Neil Pitman(495)
Atmospheric Monitoring with Arduino by Patrick Di Justo & Emily Gertz(493)
