This document provides information on arrays, structures, and pointers in C++. It defines an array as a collection of data storage locations that hold the same type of data. Arrays can be one-dimensional or multi-dimensional. Structures are collections of variables of different data types grouped together under a single name. Pointers are variables that store the address of another variable in memory. Pointers can be used to access elements in an array using pointer arithmetic and to dynamically allocate memory using operators like new and delete.
I prepared this slides for the student of FSC BSC BS Computer Science Students. These Slides are very easy to read and understand the pointer logic used in C++ Programming.
All Topic related to pointer is discussed and examples are given
I prepared this slides for the student of FSC BSC BS Computer Science Students. These Slides are very easy to read and understand the pointer logic used in C++ Programming.
All Topic related to pointer is discussed and examples are given
The objective of the Level 5 Diploma in Information Technology is to provide learners with an excellent foundation for a career in a range of organisations. It designed to ensure that each learner is ‘business ready’: a confident, independent thinker with a detailed knowledge of Information Technology, and equipped with the skills to adapt rapidly to change.
Very interesting C programming Technical Questions Vanathi24
This power point explains about some interesting interview technical questions from C programming. All the programs are explained with detailed necessary information.
c++ pointers by Amir Hamza Khan (SZABISTIAN)Ameer Hamxa
This slides will help you to learn pointers in c++ and i have put in some programs in this slides to help beginners in c++ and also you can use it as your own presentation lol ;)
follow me on facebook https://www.facebook.com/Ameerii132
and you are welcome for questions and quirries
An introduction to pointers and references in C++ (with elements of C++11 and C++14). The presentation introduces the readers to the concepts of pointers and references through the pragmatic need of writing a swap function between integers. Generic programming notions (e.g., type constructors) are adopted when useful for the explanation.
An array is a very important derived data type in the C programming language. This presentation contains basic things about arrays like definition, initialization, their types, and examples.
The objective of the Level 5 Diploma in Information Technology is to provide learners with an excellent foundation for a career in a range of organisations. It designed to ensure that each learner is ‘business ready’: a confident, independent thinker with a detailed knowledge of Information Technology, and equipped with the skills to adapt rapidly to change.
Very interesting C programming Technical Questions Vanathi24
This power point explains about some interesting interview technical questions from C programming. All the programs are explained with detailed necessary information.
c++ pointers by Amir Hamza Khan (SZABISTIAN)Ameer Hamxa
This slides will help you to learn pointers in c++ and i have put in some programs in this slides to help beginners in c++ and also you can use it as your own presentation lol ;)
follow me on facebook https://www.facebook.com/Ameerii132
and you are welcome for questions and quirries
An introduction to pointers and references in C++ (with elements of C++11 and C++14). The presentation introduces the readers to the concepts of pointers and references through the pragmatic need of writing a swap function between integers. Generic programming notions (e.g., type constructors) are adopted when useful for the explanation.
An array is a very important derived data type in the C programming language. This presentation contains basic things about arrays like definition, initialization, their types, and examples.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
2. • An array is a collection of data
storage locations, which holds the
same type of data. Each storage
location is called an element of the
array
2
Introduction To Array
3. • An array is a structured collection of components (often called
array elements) that can be accessed individually by specifying
the position of a component with a single index value.
• General form to declare an array
Data_type Array_name [ Array_size];
– Data_type is the specifier that indicates what data type .
– Array_name is the name of the declared array.
– Array_size defines how many elements the array can contain
3
Array Declarations
4. float price[10];
float specifies as the data type
price is the name of the declared array
the size of the array is 10
char name [50];
int age [20];
4
Example:
5. • int x[6]={ 1, 13, 33, 7, 20, 6};
– The integer inside the braces { and } are
assigned to the corresponding elements of
the array.
5
Initializing An Array
6. 1 13 33 7 20 6
6
Illustrate one dimensional array
int x[6]={ 1, 13, 33, 7, 20, 6};
x[0] x[1] x[2] x[3] x[4] x[5]
index
Element 2 Element 3 Element 4 Element 5 Element 6Element 1
7. int x [9] = {0,3,7,3,0,20,61,17,800 };
double x [8] = {1.2, 1.4, 1.7, 2.6, 3.4, 2.6,
1.2, 3.1};
char x[9] = {‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’};
7
Example:
8. # include <iostream>
using namespace std;
int main()
{
float price[3];
cout <<“price 1:";
cin>>price[0];
cout <<“price 2:";
cin>>price[1];
cout <<“price 3:";
cin>>price[2];
cout<<“TOTAL PRICE:”<<price[0]+price[1]+price[2];
}
return 0;
}
8
Example of program
9. # include <iostream>
using namespace std;
int main()
{
float price[3];
int i;
total=0;
for( i=0;i<3;i++)
{
cout <<“price :“<<0+i<<;
cin>>price[i];
total=total+price[i];
}
cout<<“TOTAL PRICE:”<<total;
return 0;
}
9
Example of program
10. # include <iostream>
using namespace std;
main()
{
int a;
int number[6];
for (a=0;a<6;a++)
{
number[a]= a+5;
cout <<"number[ " <<a<< " ]"<<"is initialized with = " <<number[a]<<"n";
}
return 0;
}
10
Example of program
11. • It is possible to have arrays of more than one
dimension.
• Each dimension is represented as a subscript
in the array.
• Therefore, a two-dimensional array has two
subscripts.
11
Two Dimensional Array
12. Type ArrayName [sizeofrow][sizeofcolumn];
Example : float price[4][5];
12
Array Declarations
When dimensioning a two dimensional table, always put the
number of rows first and number of column second.
16. # include <iostream>
using namespace std;
int main()
{
float mark[5][2]={5,2.5,4,0,6,8,10,9.5,5.5,7};
int i;
for( i=0;i<5;i++)
{
for(j=0;j<2;j++)
{
cout <<“mark :“<<mark[i][j]<<endl;
}
}
return 0;
}
16
Example of program
18. POINTER
• Pointer is a variable which value is used to
point to another variable.
• It is able to assign different values to a pointer
variable and the value contained by a pointer
must be an address that indicates the location
of another variable in the memory.
• That is why a pointer is also called an address
variable.
19. WHAT & WHY of Pointers
• We use pointers as a technique:
- to develop lighter & faster programs.
- to optimally use the memory space.
• Pointers are also names (variable) – special ones.
• Can be likened to representatives of other variables - these include
ordinary variables, arrays, structures.
• Instead of directly pass or use the variables, pointers are used – why?
- Pointers are more lighter than the other variables.
- Pointers are more flexible – point to variable A, then point to B,
and point to C, and so on.
• no need to copy the values of the pointed variables, but only addresses
(location in RAM).
• If the variables contain data (values), pointers only contain the addresses
of the variables that they point to – hence the name is pointer.
20. Declaring pointer
• The general form of a pointer declaration:
data type *pointer_name;
• Data type specifies the type of data to which the
pointer points.
• Pointer name is the name of the pointer variable.
• Asterik (*) indicates the variable as a pointer.
22. Assign the address of a variable to the
pointer
syntax:
pointerName=&VariableName;
Example:
ptrc=&c;
no=#
ptrnum2=&num1;
23. Working with Pointers
• How do we represent num1 (type of int) with
a pointer?
int num1; num1
600000
int * pnum1;
pnum1 500000
pnum1 = & num1;
1
2
3
600000pnum1
num1 600000
500000
24. Variable name is count and the value is 5.
Write pointer to assign the address of a variable to the
pointer.
int count=5;
int *ptrcount;
ptrcount=&count;
25. Example of program
#include<iostream>
using namespace std;
int main()
{
int number=5;
int *ptrn;
ptrn=&number;
cout<<“The value of variable number is:”<<number;
cout<<“nThe address of variable number is:”<<&number;
cout<<“The address of variable number is:”<<ptrpn;
cout<<“The value of variable number is:”<<*ptrn;
cout<<endl;
return 0;
}
The value of variable number is:5
The address of variable number is:0012FF7C
The address of variable number is:0012FF7C
The value of variable number is:5
26. Example of program
#include<iostream>
using namespace std;
int main()
{
int numb=50;
int *ptra;
ptra=&numb;
*ptra=*ptra+7;
cout<<“The manipulated value is:”<<*ptra;
return 0;
} The manipulated value is:57
28. New operator
• Provides a dynamic storage allocation in
computer memory location.
• Can be used to create variables that have no
identifiers to serve as their names.
• The no identifiers variables are referred to via
pointer.
30. Example of program
#include<iostream>
using namespace std;
int main()
{
int *pointer1, *pointer2;
pointer1=new int;
*pointer1=80;
pointer2=pointer1;
cout<<“The value of *pointer1 is:”<< *pointer1<<endl;
cout<<“The value of *pointer2 is:”<< *pointer2<<endl;
pointer1=new int;
*pointer1=100;
cout<<“The value of *pointer1 is:”<< *pointer1<<endl;
cout<<“The value of *pointer2 is:”<< *pointer2<<endl;
return 0;
}
The value of *pointer1 is:80
The value of *pointer2 is:80
The value of *pointer1 is:100
The value of *pointer2 is:80
31. Delete operator
• Eliminates a dynamic variable and return the
memory to the free store.
• This operation can be done if a program no
longer needs the dynamic variable.
• Now the free store memory can be reused to
create a new dynamic variable.
33. Example of program
#include<iostream>
using namespace std;
int main()
{
int *pointer1, *pointer2;
pointer1=new int;
*pointer1=80;
pointer2=pointer1;
cout<<“The value of *pointer1 is:”<< *pointer1<<endl;
cout<<“The value of *pointer2 is:”<< *pointer2<<endl;
delete pointer1;
cout<<“The value of *pointer1 is:”<< *pointer1<<endl;
cout<<“The value of *pointer2 is:”<< *pointer2<<endl;
cout<<“The address of *pointer1 is:”<< &pointer1<<endl;
cout<<“The address of *pointer2 is:”<< &pointer2<<endl;
return 0;
}
The value of *pointer1 is:80
The value of *pointer2 is:80
The value of *pointer1 is:-572662307
The value of *pointer2 is-572662307
The address of *pointer1 is:0012FF7C
The address of *pointer1 is:0012FF78
34. Relationship Between Arrays and
Pointers
Syntax:
pointerName=arrayName;
Example:
int age[5]={10,20,30,40,50};
int *ptrage;
ptrage=age;
35. The Relationship Between Arrays and
Pointers
We can visualize this array like this:
ptrage age
[0]
[1]
[2]
[3]
[4]
10
20
30
40
50
36. The Relationship Between Arrays and
Pointers
• Array name is starting address of array
int vals[] = {4, 7, 11};
starting address of vals: 0x4a00
cout << vals; // displays 0x4a00
cout << vals[0]; // displays 4
4 7 11
37. The Relationship Between Arrays and
Pointers
• Array name can be used as a pointer constant
int vals[] = {4, 7, 11};
cout << *vals; // displays 4
• Pointer can be used as an array name
int *ptrv = vals;
cout << ptrv[1]; // displays 7
38. Example of program
#include<iostream>
using namespace std;
int main()
{
int array[ ]={9,8,7,6,5,4};
int *pointer1;
pointer=array;
for( int a=0;a<6;a++)
{
cout<<“The address :”<< (pointer+a)<<“while the value is:”<<*(pointer+a)<<endl;
}
return 0;
}
The address: 0012FF68 while the value is: 9
The address: 0012FF6C while the value is: 8
The address: 0012FF70 while the value is: 7
The address: 0012FF74 while the value is: 6
The address: 0012FF78 while the value is: 5
The address: 0012FF7C while the value is: 4
39. Given:
int vals[]={4,7,11};
int *ptrv = vals;
• What is ptrv + n?
cout << *(ptrv+1); // displays 7
cout << *(ptrv+2); // displays 11
• Must use ( ) in expression
40. Array Access
• Array elements can be accessed in many ways.
Array access method Example
array name and [ ] vals[2] = 11;
pointer to array and [ ] ptrv[2] = 11;
array name and subscript
arithmetic
*(vals+2) = 11;
pointer to array and
subscript arithmetic
*(ptrv+2) = 11;
41. Array Access
• Array notation
vals[i]
• is equivalent to the pointer notation
*(ptrv + i) or ptrv[i]
42. Pointer Arithmetic
• Some arithmetic operators can be used
with pointers:
– Increment and decrement operators ++, --
– Integers can be added to or subtracted from
pointers using the operators +, -, +=, and -=
– One pointer can be subtracted from another by
using the subtraction operator -
43. Pointer Arithmetic
• Assume the variable definitions
int vals[]={4,7,11};
int *ptrv = vals;
• Examples of use of ++ and --
ptrv++; // points at 7
ptrv--; // now points at 4
44. Pointer Arithmetic
• Assume the variable definitions:
int vals[]={4,7,11};
int *ptrv = vals;
• Example of use of + to add an int to a
pointer:
cout << *(ptrv + 2)
– This statement will print 11
45. Pointer Arithmetic
• Assume the variable definitions:
int vals[]={4,7,11};
int *ptrv = vals;
• Example of use of +=:
ptrv = vals; // points at 4
ptrv += 2; // points at 11
47. STRUCTURE
• Structure is a collection of variable under a
single name.
• Variable can be of any type: int, float, char etc.
• The main difference between structure and
array is :
– Array are collection of the same data type.
– Structure is a collection of variable under a single
name.
48. Declaring a structure
• The structure is declared by using the keyword
struct followed by structure name, also called
a tag.
• Then the structure members (variable) are
defined with their type and variable names
inside the open and close braces { and }.
• Finally, the closed braces end with a
semicolon denoted as ; following the
statement.
49. example
• Structure name is customer
• Three variables:
- custnum of type int
- salary of type float structure members
- commission of type double
50. This structure is declared as follows:
struct customer
{
int custnum;
float salary ;
double commission;
};
51. Declare structure variable
• This similar to variable declaration
• For variable declaration, data type is defined
followed by variable name.
• For structure variable declaration, the data
type is the name of the structure followed by
the structure variable name.
structure_name structure_variable _name
53. Assign value to a structure variable
THREE ways to assign values to the elements:
i) in the declaration of a record variable
customer cust1 = {111, 1500, 25.50};
ii) direct assignment
cust1.custnum = 111;
cust1.salary = 1500;
cust1.commission= 25.50;
iii) input statement
cin>>cust1.custnum;
cin>>cust1.salary;
cin>>cust1.commission;
54. Access values in structure variable
• Elements are accessed by their name.
• Syntax:
structure_variable.variable_name;
• Example:
cust1.custnum;
• The dot is called the member selector