The document discusses functions in C programming. The key points are:
1. A function is a block of code that performs a specific task. Functions allow code reusability and modularity.
2. main() is the starting point of a C program where execution begins. User-defined functions are called from main() or other functions.
3. Functions can take arguments and return values. There are different ways functions can be defined based on these criteria.
4. Variables used within a function have local scope while global variables can be accessed from anywhere. Pointers allow passing arguments by reference.
A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
An enumeration (enum) is a user-defined type (same as structure) that represents a group of constants. typedef is a keyword used to create alias name for the existing datatypes.
View study notes of Function overloading .you can also visit Tutorialfocus.net to get complete description step wise of the concerned topic.Other topics and notes of C++ are also explained.
Operators and expressions in c languagetanmaymodi4
what is operator in c language
uses of operator in c language
syatax of operator in c language
program of operator in c language
what is expressions in c language
use of expressions in c language
syantax of expressions in c language
In computer science, a pointer is a programming language object, whose value refers to (or "points to") another value stored elsewhere in the computer memory using its memory address. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.
This Presentation gives you all knowledge about #CPointers, #PointersInC.
The given slides are as follows:
1. Introduction of Pointers.
2. Systems to create a pointer in C.
3. Valid Pointer Examples in C.
4. Graphical representation of address assigning in c using pointer.
5. 1st Sample program of pointers in C.
6. Types of Pointers
7. NULL Pointer in C (Types of Pointer)
8. void Pointer in C (Types of Pointer)
9. Wild Pointer in C (Types of Pointer)
10. Changing value of variable using pointer
11. Update and Access value of variable using pointer in example.
12. Types of format specifies to print address in different format.
13. Advantages of Pointer in C.
14. Disadvantages of Pointer in C.
15. Pointers with Array using Programs. #pointerwitharray
16. Another Example of #pointerwitharray.
17. Relationship Between Arrays and Pointers.
18. Relationship Between Arrays and Pointers explanation with diagram.
19. Pointers and String. #PointersAndString
20. Function with Array Parameters using pointers.
21. Passing Pointers to Function or Pointer argument function. #PointerWithFunction
This PPT contains A to Z topics of C programming language. It makes learners to find it easy to learn C. Tutors also can use the PPT for better presentation.
An enumeration (enum) is a user-defined type (same as structure) that represents a group of constants. typedef is a keyword used to create alias name for the existing datatypes.
View study notes of Function overloading .you can also visit Tutorialfocus.net to get complete description step wise of the concerned topic.Other topics and notes of C++ are also explained.
Operators and expressions in c languagetanmaymodi4
what is operator in c language
uses of operator in c language
syatax of operator in c language
program of operator in c language
what is expressions in c language
use of expressions in c language
syantax of expressions in c language
In computer science, a pointer is a programming language object, whose value refers to (or "points to") another value stored elsewhere in the computer memory using its memory address. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.
This Presentation gives you all knowledge about #CPointers, #PointersInC.
The given slides are as follows:
1. Introduction of Pointers.
2. Systems to create a pointer in C.
3. Valid Pointer Examples in C.
4. Graphical representation of address assigning in c using pointer.
5. 1st Sample program of pointers in C.
6. Types of Pointers
7. NULL Pointer in C (Types of Pointer)
8. void Pointer in C (Types of Pointer)
9. Wild Pointer in C (Types of Pointer)
10. Changing value of variable using pointer
11. Update and Access value of variable using pointer in example.
12. Types of format specifies to print address in different format.
13. Advantages of Pointer in C.
14. Disadvantages of Pointer in C.
15. Pointers with Array using Programs. #pointerwitharray
16. Another Example of #pointerwitharray.
17. Relationship Between Arrays and Pointers.
18. Relationship Between Arrays and Pointers explanation with diagram.
19. Pointers and String. #PointersAndString
20. Function with Array Parameters using pointers.
21. Passing Pointers to Function or Pointer argument function. #PointerWithFunction
This PPT contains A to Z topics of C programming language. It makes learners to find it easy to learn C. Tutors also can use the PPT for better presentation.
Website Link :
https://customercaretoll.com/listings/american-airlines
Social Link :
https://plus.google.com/u/0/114596345956592139716
https://www.facebook.com/gordon.clark.3939
https://twitter.com/gordonclark35
https://in.pinterest.com/clarkgordon8264/
https://groups.google.com/forum/#!forum/gordon-clark
La rinconada18mar17m ldealfonsorodriguezvera[1]Winston1968
Presentamos el "Morning Line" del handicapper Alfonso Rodríguez Vera para el programa de carreras del sábado 18 de marzo de 2017 en el hipódromo nacional La Rinconada, Caracas, Venezuela.
Functions - C Programming
What is a Function? A function is combined of a block of code that can be called or used anywhere in the program by calling the name. ...
Function arguments. Functions are able to accept input parameters in the form of variables. ...
Function return values
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
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.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
Data privacy is one of the most critical issues that businesses face. This presentation shares insights on the principles and best practices for ensuring the resilience and security of your workload.
Drawing on a real-life project from the HR industry, the various challenges will be demonstrated: data protection, self-healing, business continuity, security, and transparency of data processing. This systematized approach allowed to create a secure AWS cloud infrastructure that not only met strict compliance rules but also exceeded the client's expectations.
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.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
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.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
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.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
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!
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
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.
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Functions in c
1. Functions
• A function is a sub program, which performs a
particular task when called.
• A C program is a collection of some functions.
• main() is the predefined function from where the
execution of a program starts.
• C program = Main() + user defined functions
2. ..continued
• Uses of functions:
• Re-useability
• Modularity
• Re-usability: C functions are used to avoid rewriting same code again and
again in a program.
• We can call functions any number of times in a program and from any place in
a program for the same task to be performed.
• Modularity: Dividing a big task into small pieces improves understandability
of very large C programs.
• A large C program can easily be tracked when it is divided into functions.
3. Defining a Function
• Syntax:
function definition function
declaration
return_type function_name(List of
parameters)
{
//set of statements
function body
4. ..continued
• Function definition – This contains all the
statements to be executed.
Function definition = function declaration +function body
A function body is a group of statements enclosed
in flower brackets.
eg: void main() function declaration
{
int a=10; function definition
function body
printf(“a = %d”,a);
}
5. Function terminology
• Function prototype
• Function definition
• Function call
Function prototype or declaration - This informs
compiler about the function name, function
parameters and return value’s data type.
Syntax: return_type function_name(parameter list);
This is written before main() function. To inform the
compiler that there exists a function in the program.
6. Function Call
• This statement actually calls the function.
• Syntax: function_name( list of parameter
values);
• This statement is written in the calling
function.
• With this statement, the control is
transferred to the function definition.
• Eg: sum(10,20);
7. Function calls
• Functions can be defined in any one of the
following 4 different ways.
No arguments , No return value .
No arguments , With return value .
With arguments , No return value .
With arguments , With return value .
• Arguments:-
These values are passed from main()
function to the invoked function . Generally
8. Ex:- Program to print the sum of given two numbers using
functions?
i)No arguments , No return value
void add ( ) ; //function
prototype
void main()
{
add(); //function calling
}
void add() //function definition
{
int a,b,c;
9. ii)No arguments , With return value
int add ( ) ; //function prototype
void main()
{
printf(“nsum is=%d”,add()); //
function call
}
int add() ; //function definition
{
int a,b,c;
10. iii)With arguments , No return value
void add ( int , int ) ; //function
prototype
void main()
{
int a , b ;
printf(“enter any two numbers”);
scanf(“%d%d”,&a,&b);
add(a,b); //function call
}
11. iv)With arguments , With return value
int add ( int , int ) ; //function
prototype
void main()
{
int a , b ;
printf(“enter any two numbers”);
scanf(“%d%d”,&a,&b);
printf(“sum is=%d”,add(a,b));
//function call
12. Methods of Function calls
There are two methods
that a C function can
be called from a
program. They are,
Call by value Call by reference
13. Arguments
• Actual Argument: This is the argument
which is used in the function call.
– Eg: sum(a,b); // a and b are actual arguments
• Formal Argument: This is the argument
which is used in the function definition.
– Eg: void sum(int m, int n) //m and n are
formal arguments.
{
.
.
}
14. Call/pass by value
• In this method, the values only values of
actual arguments are passed into formal
arguments.
• Different Memory is allocated for both
actual and formal parameters.
• The value of the actual parameter can not
be modified by formal parameter.
15. Call/pass by reference
– In this method, the address of the variable, not value ,is
passed to the function as parameter.
– Same memory is used for both actual and formal
parameters since only address is used by both
parameters.
– The value of the actual parameter can be modified by
formal parameter.
16. Recursion
• It is possible in c for functions to call
themselves.
• Recursion is a technique in which a
function calls itself.
• Eg: int fact(int a) //function definition
{
int f;
if(a==1)
return 1;
else
f=a*fact(a-1); //function call
17. Scope of the variable
• Two kinds of variables: Local and Global
– Local - A variable declared within the function
is called as local variable. This can be used
within that function only.
• Eg: void main()
{
int x,y;
.
.
}
X and y are local variables. Their scope is upto main function.
They can be used in only main function.
18. Scope of the variables
• Global variable: A variable declared global
section of the program. This can be used
anywhere in the program.
• Eg: int x; // global variable
void main()
{
int y; // local variable
.
}
void sum()
{
int a,b,c; //local variables
.
19. C – Storage Class Specifiers
• Storage class specifiers tells the compiler
– where to store a variable,
– how to store the variable,
– what is the initial value of the variable and
– life time of the variable.
• Syntax: storage_specifier data_type
variable _name
• Types : 4
– auto
– extern
20. auto
• The scope of this auto variable is within
the function only.
• It is declared using auto keyword. It is
equivalent to local variable.
• All local variables are auto variables by
default.
21. extern
• The scope of the extern variable is global.
• It is available throughout the main
program.
• Is declared using the keyword extern. Can
be declared anywhere in the program.
• It is stored in memory.
22. static
• It’s scope is local. It’s value persists
between function calls.
• Declared using static keyword.
• Stored in memory.
• Default is zero.
23. register
• Scope is local.
• Available within the function.
• Stored in register memory.
• Default value is garbage value.
• Declared using register keyword.
25. Structures
• A structure is a collection of one or more
variables, usually of different types,
grouped together under a single name.
• A structure can be declared using the
keyword ‘struct’.
• Syntax: struct structure_name
{
26. Structure example
• structure example: struct book
{
char book_name[20];
char author[20];
int no_of_pages;
float price;
}
27. Structure members
• Each variable inside the structure
definition is called a structure member.
• In the book example above,
book_name , author, no_of_pages and
price are the struct members.
28. Structure variables
• A structure variable can be declared using
the structure name.
• Syntax:
struct struct_name
variable_name1,variable_name2,…;
• Example: struct book b1,b2,b3;
29. Accessing structure members
• Structure members can be accessed using
the dot(.) operator.
• Syntax : struct_variable . struct
member;
• Example : b1.book_name;
b2.book_name;
etc.,
30. Initializing structure members
• Intializing can be done in two ways:
1. using assignment operator (=)..
2. from the keyboard
1. Using the assignment operator:
eg: b1.no_of_pages=100;
b1. price=235;
2. From the keyboard:
eg: scanf(“%d”,&b1.no_of_pages);
31. Array of structures
• An array of structures can be declared in
the same way we declare any other array.
• Example: struct book b1[10];
b1 is the array of structures which
holds 10 structures.
• Each structure variable is accessed
using the array index.
32. Union
• A Union is a collection of one or more
variables, usually of different types,
grouped together under a single name.
• A union can be declared using the
keyword ‘union’.
• Syntax: union union_name
{
33. union example
• Union example: union book
{
char book_name[20];
char author[20];
int no_of_pages;
float price;
}
34. Union members
• Each variable inside the union definition is
called a union member.
• In the book example above,
book_name , author, no_of_pages and
price are the union members.
35. union variables
• A union variable can be declared using the
union name.
• Syntax:
union union_name
variable_name1,variable_name2,…;
• Example: union book b1,b2,b3;
36. Accessing union members
• union members can be accessed using
the dot(.) operator.
• Syntax : union_variable .union
member;
• Example : b1.book_name;
b2.book_name;
etc.,
37. Initializing union members
• Intializing can be done in two ways:
1. using assignment operator (=)..
2. from the keyboard
1. Using the assignment operator:
eg: b1.no_of_pages=100;
b1. price=235;
2. From the keyboard:
eg: scanf(“%d”,&b1.no_of_pages);
38. Array of unions
• An array of unions can be declared in the
same way we declare any other array.
• Example: union book b1[10];
b1 is the array of unions which
holds 10 unions.
• Each union variable is accessed using
the array index.
39. Differences between structure and
union
S.no C Structure C Union
1 Structure allocates storage space for all its members separately.
Union allocates one common storage space for all its
members.
Union finds that which of its member needs high storage
space over other members and allocates that much space
2 Structure occupies higher memory space. Union occupies lower memory space over structure.
3 We can access all members of structure at a time. We can access only one member of union at a time.
4
Structure example:
struct student
{
int mark;
char name[6];
double average;
};
Union example:
union student
{
int mark;
char name[6];
double average;
};
5
For above structure, memory allocation will be like
below.
int mark – 2B
char name[6] – 6B
double average – 8B
Total memory allocation = 2+6+8 = 16 Bytes
For above union, only 8 bytes of memory will be allocated
since double data type will occupy maximum space of
memory over other data types.
Total memory allocation = 8 Bytes
40. Pointers
• A pointer is a variable which points to
another variable.
• A pointer stores the address of another
variable.
• Pointers are used to allocate memory
dynamically.
41. Address of operator
• & is called as ‘addressof ‘operator.
• Helps to store the address of a variable in
a pointer.
• Then the pointer points to that variable.
• A pointer variable is default initalized to
null.
42. Advantages of pointers
• To return more than one value from a
function.
• To pass arguments to functions by
reference.
• Pointer concepts are very useful in
development of system software.
• With the address known, data can be
accesses from any where in the
program.