Multidimensional arrays store data in tabular form with multiple indices. A 3D array declaration would be datatype arrayName[size1][size2][size3]. Elements can be initialized and accessed similar to 2D arrays but with additional nested brackets and loops for each dimension. Functions allow dividing a problem into smaller logical parts. Functions are defined with a return type, name, parameters and body. Arguments are passed by value or reference and arrays can also be passed to functions. Recursion occurs when a function calls itself, requiring a base case to terminate the recursion.
Hello there, this powerpoint presentation is made by Ansh kashyap(me) the topic of this presentation is "Data types in C".
Data types used in C language refer to an extensive system that we use to declare various types of functions or variables in a program. Here, on the basis of the type of variable present in a program, we determine the space that it occupies in storage, along with the way in which the stored bit pattern will be interpreted.
A data type specifies the type of data that a variable can store such as integer, floating, character, etc.
Hello there, this powerpoint presentation is made by Ansh kashyap(me) the topic of this presentation is "Data types in C".
Data types used in C language refer to an extensive system that we use to declare various types of functions or variables in a program. Here, on the basis of the type of variable present in a program, we determine the space that it occupies in storage, along with the way in which the stored bit pattern will be interpreted.
A data type specifies the type of data that a variable can store such as integer, floating, character, etc.
This is presentation, that covers all the important topics related to strings in python. It covers storing, slicing, format, concatenation, modification, escape characters and string methods.
The file attatched also includes examples related to the slides shown.
Note: This slide was created by me. I am Md. Touhidul Islam Shawan. Here in these slide I have written about some basic points of function of c program and how the function works.
This presentation is Unary operator overloading(prefix).
Here ,I try to describe how to Unary operator overloaded and its types with example. may be you can happily read this.
This is presentation, that covers all the important topics related to strings in python. It covers storing, slicing, format, concatenation, modification, escape characters and string methods.
The file attatched also includes examples related to the slides shown.
Note: This slide was created by me. I am Md. Touhidul Islam Shawan. Here in these slide I have written about some basic points of function of c program and how the function works.
This presentation is Unary operator overloading(prefix).
Here ,I try to describe how to Unary operator overloaded and its types with example. may be you can happily read this.
It tells about functions in C++,Types,Use,prototype,declaration,Arguments etc
function with
A function with no parameter and no return value
A function with parameter and no return value
A function with parameter and return value
A function without parameter and return value
Call by value and address
Library Functions, User defined functions, Recursion, Function declaration, Local and global variables, Use of array in function, Passing by Value, Passing by Address
https://github.com/ashim888/csit-c
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Digital Tools and AI for Teaching Learning and Research
Functions
1. Multidimensional Arrays
• Define multidimensional arrays as array of arrays.
• Data in multidimensional arrays are stored in tabular form (in row major
order).
Syntax
data_type array_name[size1][size2]....[sizeN];
• Three dimensional array: int three_d[10][20][30];
• Similarly array int x[5][10][20] can store total (5*10*20) = 1000 elements.
2.
3. • Initializing & Accessing 3-DArray:
– Initialization & Accessing is same as that of 2D arrays.
– The difference is the number of dimension increases so the number of
nested braces and number of loops will also increase.
Method 1:
int x[2][3][4] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23};
Better Method:
int x[2][3][4] = { { {0,1,2,3}, {4,5,6,7}, {8,9,10,11} }, { {12,13,14,15},
{16,17,18,19}, {20,21,22,23} } };
5. Functions
• A function is a block of code that performs a specific task.
• A function is a self contained block of statements that perform a logical
task of some kind.
• C allows the user to define functions according to our need. These
functions are known as user-defined functions.
• Complex Large problem is easier to solve by dividing it into several smaller,
self-contained parts that perform a specific task called Functions ---
Modularization Concept
6.
7. Advantages of Functions
• Logical clarity – decomposing a program into several concise functions
– Makes program easier to understand.
– Easier to write
– Easier to debug
• Separates the concept (what is done) from the implementation (how it is
done).
• Avoids (redundant) repeated programming of same instructions
Repeated Instructions are placed inside function
Access to function many times with different data when needed
• To build customized library of frequently used routines contains system-
dependent features
• Portability – programs are written that are independent of system-
dependent features
8. Introduction
• One important function is main()
• Execution always begin and end by instructions in main()
• Additional functions will be subordinate to main
• Sub Function definitions may appear in any order
• One function cannot be embedded within another
• Same function can be called from different places of program
• C supports lot of predefined functions known as Library Functions
• User is free to define its own functions and use it called as user-defined
functions
– Function Body
– Function Call
– Function Prototype
• Information is passed to the function via special identifiers called
arguments (parameters)
• Information is returned via return statement
9. Defining a Function/ Function Definition
• It contains block of code to perform a specific task
• When a function is called, the compiler starts
executing the codes inside the body of a function.
Syntax:
returnType functionName(type1 arg1, type2 arg2, ...)
{
//body of the function
}
10. • The first line is known as function header and the statements within the
opening and closing braces is known as the function body.
• Function header:-
– Consists of return type, the function name, and the formal
parameter list.
– Function name is any valid identifier
– Return type specifies the type of value that the function is expected to
return to the program calling the function. By default it is integer type.
– The parameter list called formal parameters declares the variables that
will receive the data sent by the calling program.
– Formal parameters are local to function
• Function body:-
– Contains the declaration and executable statements necessary for
performing the required task.
– It is enclosed with open and closed braces
11. void sum(int a, int b)
{
int c;
c = a + b;
printf(“Sum = %d”,c);
}
13. Function Call/ Accessing a Function
• A function can be called by using its name followed by a list of
actual arguments.
• During function call, control of the program is transferred to the
user-defined function
• It is the statement inside the main( ) or sub function
Syntax:
functionName(arg1, arg2, ...);
• Here, value of actual argument is transferred into function and
assigned to formal argument
15. FUNCTION PROTOTYPE
• It is the declaration of a function
• It specifies function's name, parameters and return type
• It doesn't contain function body
• It gives information to the compiler that the function may later be used
in the program.
• It is usually written in the beginning of the program
Syntax:
returnType functionName(type1 arg1, type2 arg2,...);
• It is not needed if the function is defined before the main( ) function.
• C prefers top-down approach.
• Argument names can be omitted since these are “dummy arguments”
that are not used inside our programs
• Function Prototypes are not mandatory in C
19. • Actual arguments:
– Arguments passed in a function call are called actual arguments.
– These arguments are defined in the calling function.
• Formal arguments:
– Parameters/arguments in a function definition
– Scope of formal arguments is local to the function definition in
which they are used.
– Belongs to the called function
– Copy of the actual arguments.
– A change in formal arguments would not be reflected in the
actual arguments.
20. PASSING ARGUMENTS TO FUNCTIONS
• Argument refers to the variable passed to the function.
• In the above example, two variables a and b are passed during function
call. These arguments are called actual arguments
• The parameters x and y in function definition accepts the passed
arguments. These arguments are called formal parameters.
• We can pass arguments by value – Copies of data passed
• We can pass arguments by reference – Original copy of data is passed
• We can pass array to function – address of first array element is passed
21.
22. Call by Value vs. Call by Reference
Call by Value Call by Reference
This is the usual method to call a function in
which value of the variable is passed as an
argument
In this method, the address of the variable
is passed as an argument
Any alternation in the value of the argument
passed is local to the function and is not
accepted in the calling program
Any alternation in the value of the
argument passed is accepted in the calling
program
Memory location occupied by formal and
actual arguments values are different
Memory location occupied by formal and
actual arguments values are same
Since a new location is created, this method
is slow
Since the existing memory location is used
through its address, this method is fast
There is no possibility of wrong data
manipulation since the arguments are
directly used in an application
There is a possibility of wrong data
manipulation since the addresses are used
in an expression. A good skill of
programming is required here
23. • Example Program:
– Swap Two Numbers using Call by Value
– Swap Two Numbers using Call by Reference
24. Passing Array to a function
• To pass an entire array to a function, only the name of the array is passed as an
argument.
functionname(arrayname); //Function Call
• Define function in one of the ways:
• First way:
return_type function(type arrayname[])
Declaring blank subscript notation [] is the widely used technique.
• Second way:
return_type function(type arrayname[SIZE])
Optionally, we can define size in subscript notation [].
• Third way:
return_type function(type *arrayname)
• Elements are not passed to function
• Passes the address of the first array element
• Now, formal argument becomes the pointer to the first array element
26. RETURN STATEMENT
• The return statement terminates the execution of a function and returns a
value to the calling function.
• The program control is transferred to the calling function after return
statement.
Syntax:
return (expression);
Example:
return a;
return (a+b);
• The type of value returned from the function and the return type specified
in function prototype and function definition must match.
27. • The value of variable result is returned to the variable sum in the main( )
function.
• Program can have number of return statements.
• main() returns 0 or 1 to OS by default: 0 --- successful completion, 1 –
Unsuccessful/ Interruption
• Sub function returns 0 or 1 to the calling function: 0 – unsuccessful, 1 –
successful execution
29. • User-defined functions can be categorized as:
– Function with no arguments and no return value
– Function with no arguments and a return value
– Function with arguments and no return value
– Function with arguments and a return value
30. 1) No arguments passed and no
return Value
#include <stdio.h>
void addNumbers( ); // function prototype
void main()
{
addNumbers( ); // function call without args & return
}
void addNumbers( ) // function definition
{
int n1,n2, sum;
printf("Enters two numbers: ");
scanf("%d %d",&n1,&n2);
sum = n1+n2;
printf("sum = %d",sum);
}
31. • The addNumbers( ) function takes no arguments and doesn’t return any
value
• The empty parentheses in addNumbers( ); statement inside the main()
function indicates that no argument is passed to the function.
• The return type of the function is void. Hence, no value is returned from
the function.
32. 2) No arguments passed but a return
value
#include <stdio.h>
int addNumbers( ); // function prototype
void main()
{
sum = addNumbers( ); // function call with return
printf("sum = %d",sum);
}
int addNumbers( ) // function definition
{
int n1,n2, result;
printf("Enters two numbers: ");
scanf("%d %d",&n1,&n2);
result = n1+n2;
return result; // return statement
}
33. • The empty parentheses in sum = addNumbers( ); statement indicates that
no argument is passed to the function.
• The value returned from the function is assigned to sum.
• Here, the addNumbers( ) function takes input from the user and returns
resultant value to the main( ).
34. 3) Argument passed but no return
value
#include <stdio.h>
void addNumbers(int a, int b); // function prototype
void main()
{
int n1,n2,sum;
printf("Enters two numbers: ");
scanf("%d %d",&n1,&n2);
addNumbers(n1, n2); // function call with arguments
}
void addNumbers(int a,int b) // function definition
{
int result;
result = a+b;
printf("sum = %d",result); //No Return Statement
}
35. • The integer values entered by the user is passed to addNumbers(n1,n2)
function.
• This function calculates and prints the result.
36. 4) Argument passed and a return
value
#include <stdio.h>
int addNumbers(int a, int b); // function prototype
void main()
{
int n1,n2,sum;
printf("Enters two numbers: ");
scanf("%d %d",&n1,&n2);
sum = addNumbers(n1, n2); // function call
printf("sum = %d",sum);
}
int addNumbers(int a,int b) // function definition
{
int result;
result = a+b;
return result; // return statement
}
37. • The input from the user is passed to function.
• The function checks calculates and returns the result
• Then, the result is displayed from the main() function
38. RECURSION FUCTION
• A function that calls itself is known as a recursive function. And, this
technique is known as recursion.
• The recursion continues until some condition is met to prevent it.
• To prevent infinite recursion, if...else statement can be used where one
branch makes the recursive call and other doesn't.
• A recursive function performs the tasks by dividing it into the subtasks.
39. • Recursion program consists of two parts:
– Base case: It is a termination condition defined in the
function. It stops the recursion. It returns the final result.
– Recursive case: where the function keeps calling itself to
perform a subtask
40.
41. Example: Factorial Calculation using recursion
long fact (int);
void main()
{
int n;
long f;
printf("Enter the number : ");
scanf("%d“,&n);
f = fact(n);
printf(“Factorial of %d is %ld",n, f);
}
long fact(int n)
{
if (n==0)
return 0;
else
return n*fact(n-1);
}
Output
Enter the number : 5
Factorial of 5 is 120