1. Functions allow programmers to break complex problems into smaller, discrete tasks, making code more modular and reusable. Functions perform specific tasks and can optionally return values or receive parameters.
2. There are two types of functions - predefined functions from standard libraries like stdio.h and math.h, and user-defined functions created for specialized tasks. Functions have a name, parameters, return type, and body.
3. Functions improve code organization and readability. They separate implementation from interface and allow code reuse. Parameters can be passed by value, where copies are used, or by reference, where the function can modify the original arguments.
Programming Fundamentals Functions in C and typesimtiazalijoono
Programming Fundamentals
Functions in C
Lecture Outline
• Functions
• Function declaration
• Function call
• Function definition
– Passing arguments to function
1) Passing constants
2) Passing variables
– Pass by value
– Returning values from functions
• Preprocessor directives
• Local and external variables
Programming Fundamentals Functions in C and typesimtiazalijoono
Programming Fundamentals
Functions in C
Lecture Outline
• Functions
• Function declaration
• Function call
• Function definition
– Passing arguments to function
1) Passing constants
2) Passing variables
– Pass by value
– Returning values from functions
• Preprocessor directives
• Local and external variables
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Event Management System Vb Net Project Report.pdfKamal Acharya
In present era, the scopes of information technology growing with a very fast .We do not see any are untouched from this industry. The scope of information technology has become wider includes: Business and industry. Household Business, Communication, Education, Entertainment, Science, Medicine, Engineering, Distance Learning, Weather Forecasting. Carrier Searching and so on.
My project named “Event Management System” is software that store and maintained all events coordinated in college. It also helpful to print related reports. My project will help to record the events coordinated by faculties with their Name, Event subject, date & details in an efficient & effective ways.
In my system we have to make a system by which a user can record all events coordinated by a particular faculty. In our proposed system some more featured are added which differs it from the existing system such as security.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Automobile Management System Project Report.pdfKamal Acharya
The proposed project is developed to manage the automobile in the automobile dealer company. The main module in this project is login, automobile management, customer management, sales, complaints and reports. The first module is the login. The automobile showroom owner should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
When a customer search for a automobile, if the automobile is available, they will be taken to a page that shows the details of the automobile including automobile name, automobile ID, quantity, price etc. “Automobile Management System” is useful for maintaining automobiles, customers effectively and hence helps for establishing good relation between customer and automobile organization. It contains various customized modules for effectively maintaining automobiles and stock information accurately and safely.
When the automobile is sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting automobiles for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
Also when the user tries to sale items which are not in stock, the system will prompt the user that the stock is not enough. Customers of this system can search for a automobile; can purchase a automobile easily by selecting fast. On the other hand the stock of automobiles can be maintained perfectly by the automobile shop manager overcoming the drawbacks of existing system.
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
2. Introduction
A complex problem is often easier to solve by dividing it into
several smaller parts, each of which can be solved by itself.
This is called structured programming.
These parts are made into functions in C.These parts are made into functions in C.
main() then uses these functions to solve the original
problem.
2 Dept. of CSE&IT, DBCET, Guwahati
3. Definition
A function is a named, independent section of C code that
performs a specific task and optionally returns a value to the
calling program or/and receives values(s) from the calling
program.
3 Dept. of CSE&IT, DBCET, Guwahati
4. Categories of Function
Basically there are two categories of function:
1. Predefined functions: available in C / C++ standard library
such as stdio.h, math.h, string.h etc.
2. User-defined functions: functions that programmers create
for specialized tasks such as graphic and multimediafor specialized tasks such as graphic and multimedia
libraries, implementation extensions or dependent etc.
4 Dept. of CSE&IT, DBCET, Guwahati
5. Function Characteristics
Basically a function has the following characteristics:
1. Named with unique name .
2. Performs a specific task -Task is a discrete job that the program
must perform as part of its overall operation, such as sending a line
of text to the printer, sorting an array into numerical order, or
calculating a cube root, etc.calculating a cube root, etc.
3. Independent - A function can perform its task without
interference from or interfering with other parts of the program.
4. May receive values from the calling program (caller) -
Calling program can pass values to function for processing whether
directly or indirectly (by reference).
5. May return a value to the calling program – the called
function may pass something back to the calling program.
5 Dept. of CSE&IT, DBCET, Guwahati
6. Advantages of Function
Functions separates the concept (what is done)
from the implementation (how it is done).
Functions make programs easier to understand.
Functions can be called several times in the sameFunctions can be called several times in the same
program, allowing the code to be reused.
6 Dept. of CSE&IT, DBCET, Guwahati
7. Function Prototype
Function prototype consists of
Function name
Parameters – what the function takes in
Return type – data type function returns (default int)
Used to validate functionsUsed to validate functions
The function with the prototype
int maximum( int, int, int );
Takes in 3 ints
Returns an int
7 Dept. of CSE&IT, DBCET, Guwahati
8. Function Definition
Function definition format
return-value-type function-name( parameter-list )
{
declarations and statements
}
Function-name: any valid identifierFunction-name: any valid identifier
Return-value-type: data type of the result (default int)
void – indicates that the function returns nothing
Parameter-list: comma separated list, declares parameters
A type must be listed explicitly for each parameter unless, the parameter
is of type int
8 Dept. of CSE&IT, DBCET, Guwahati
9. Function Definition [contd..]
Declarations and statements: function body (block)
Variables can be declared inside blocks (can be nested)
Functions can not be defined inside other functions
Returning control
If nothing returnedIf nothing returned
return;
or, until reaches right brace
If something returned
return expression;
9 Dept. of CSE&IT, DBCET, Guwahati
10. Function Call
Invoking functions
Provide function name and arguments (data)
Function performs operations or manipulations
Function returns results
Format for calling functions
FunctionName( argument );
If multiple arguments, use comma-separated list
printf( "%.2f", sqrt( 900.0 ) );
Calls function sqrt, which returns the square root of its argument
All math functions return data type double
Arguments may be constants, variables, or expressions
10 Dept. of CSE&IT, DBCET, Guwahati
11. Example
#include <stdio.h>
int absolute(int); // function prototype for absolute()
int main(){
int num, answer;
printf("Enter an integer: “);
scaf(“%d”,&num);
answer = absolute(num); //function call
printf("The absolute value of is %d“, answer);
return 0; }
// Define a function to take absolute value of an integer
int absolute(int x) // function definition
{
if (x >= 0)
return x;
else
return -x;
}
11 Dept. of CSE&IT, DBCET, Guwahati
12. Purpose of return statement
The return statement serves two purposes:
On executing the return statement it immediately transfers
the control back to the calling program.
It returns the value present in the parentheses after return, to
the calling program.the calling program.
12 Dept. of CSE&IT, DBCET, Guwahati
13. Function without arguments
and without return value
#include<stdio.h>
void addnumbers(void);
void main()
{
printf(“ Program for adding two numbers using functions n”);
addnumbers();
printf(“n we are back in main function”);printf(“n we are back in main function”);
}
void addnumbers()
{
int a,b,sum;
printf(“enter the values of two numbers:”);
scanf(“%d%d”,&a,&b);
sum=a + b;
printf(“The sum of %d and %d is = %d”,a,b,sum);
}
13 Dept. of CSE&IT, DBCET, Guwahati
14. One function can also calls another function i.e., function
calls can be nested.
A function can also calls itself. These types of functions
are called recursion.
void main()
{ int fact(int a){
calculate();
}
void calculate()
{
add();
mul();
}
void add()
{
}
void mul()
{
}
int fact(int a)
{
f=a*fact(a-1);
}
14 Dept. of CSE&IT, DBCET, Guwahati
15. Library functions
Each standard library has a corresponding header file
Header files contain function prototypes and other
definitions
Can also create library of your own functions
There’s a list of available functions in many Libraries
stdio.h, math.h, string.h, conio.h etc…stdio.h, math.h, string.h, conio.h etc…
clrscr() in conio.h
Clears text mode window
15 Dept. of CSE&IT, DBCET, Guwahati
18. Different ways of calling a function
with arguments
When calling a function, arguments can be passed to a
function in two ways
Call by value
Call by reference
18 Dept. of CSE&IT, DBCET, Guwahati
19. Call By ValueCall By ValueCall By ValueCall By Value
Here arguments are being passed by value
temporary copy of argument (constant, variable, expression)
is provided to function (by way of a stack)
function can change the copy, but not the original value in
calling function
Call by value results in greater independence betweenCall by value results in greater independence between
modules
19 Dept. of CSE&IT, DBCET, Guwahati
21. #include<stdio.h>
void callbyval(int,int);
void main()
{
int a,b;
a=b=10;
printf(“nThe values of a and b before calling the function is %d and %d”,a,b);
Example
callbyval(a,b);
printf(“nAtfer the function is executed the values of a is %d and b is %d”,a,b);
}
void callbyval(int a,int b)
{
a=a * a;
b=b * b;
printf(“nThe values of a and b inside the callbyval function is %d and %d”,a,b);
}
21 Dept. of CSE&IT, DBCET, Guwahati
22. Scope Rules
Scope of a variable is that part of a program in which the variable can be
referenced
visible only in the block in which they are declared
void display(int); 1. Variable accessible in main() is ivoid display(int);
void main()
{ int i=10;
display(i);
}
void display(int j)
{ int k=27;
printf(“n %d %d”,j,k);
}
1. Variable accessible in main() is i
2. Variables accessible in display is j and
k
3. Scope of i is within the main() and
scope of j and k is in the display()
22 Dept. of CSE&IT, DBCET, Guwahati
23. An Introduction to pointersAn Introduction to pointersAn Introduction to pointersAn Introduction to pointers
2
a
4885
Location name
Value at location
Location address
This declaration tell the C compiler to:
1. Reserve space in memory to hold an integer
value
2. Associate the name “a” with this memory
location
3. Store the value 2 at this location
int a=2;
A pointer is a variable that contains the address of a variable
Pointers are declared to "point" to a variable of a particular type
(int, double, etc.)
When we use a pointer to access the value stored in the variable
to which it points, we are using indirect addressing
23 Dept. of CSE&IT, DBCET, Guwahati
24. 2
a
4885
4885
b
3376
int a=2;
int *b;
Is a pointer to an
integer
int *b;
b=&a;
printf(“nAddress of a=%u”,&a);
printf(“nAddress of a=%u”,b);
printf(“nAddress of b=%u”,&b);
printf(“nValue of b=%u”,b);
printf(“nValue of a=%d”,a);
printf(“nValue of a=%d”,*(&a));
printf(“nValue of a=%d”,*b);
Address of a=4885
Address of a=4885
Address of b=3376
Value of b=4885
Value of a=2
Value of a=2
Value of a=2
24 Dept. of CSE&IT, DBCET, Guwahati
25. Call By ReferenceCall By ReferenceCall By ReferenceCall By Reference
passed by reference
temporary copy of the address of argument is provided to function
called function can change value of the local variable in the calling
function because it knows where in memory it isfunction because it knows where in memory it is
pass by reference simulated in C by using the address operator
(&), an array name, or a pointer variable
25 Dept. of CSE&IT, DBCET, Guwahati
26. void swap(int *x,int *y);
void main()
{
int a=10,b=20;
swap(&a,&b);
printf(“n a=%d b=%d”,a,b);
20
b
8682
10
a
4885
}
void swap(int *x,int *y)
{
int t;
t=*x;
*x=*y;
*y=t;
}
10
t
2416
4885
x
6612
8682
y
4216
10
b
8682
20
a
4885
26 Dept. of CSE&IT, DBCET, Guwahati
27. Recursion
In C, a function that calls itself repeatedly, is called a recursion.
Using recursion sometimes makes coding more straightforward;
consider the calculation of n!,
27 Dept. of CSE&IT, DBCET, Guwahati
28. Recursion Example
#include<stdio.h>
long int fact( unsigned int num);
void main();
{ long f;
unsigned int n;
printf(“Enter an integer number:”);
scanf(“%u”,&n);
f=fact(n);
printf(“The factorial of a number is %ld n”,f);printf(“The factorial of a number is %ld n”,f);
}
long int fact(unsigned int num)
{
if(num==0)
return(1);
else
return ( num * fact(num-1));
}
28 Dept. of CSE&IT, DBCET, Guwahati
29. f=fact(4);
1st call to fact
num=4;
return(4 * fact(3));
2nd call to fact
num =3;
return(3 * fact(2));
2
6
24
long int fact(unsigned int num)
{
if(num==0)
return(1);
else
return ( num * fact(num-1)); return(3 * fact(2));
3rd call to fact
num =2;
return(2 * fact(1));
4th call to fact
num =1;
return(1 * fact(0));
5th call to fact
num =0;
return(1)
1
1
return ( num * fact(num-1));
}
29 Dept. of CSE&IT, DBCET, Guwahati