1. An array is a group of variables of the same type referred to by a common name. Arrays can have one or more dimensions.
2. A one-dimensional array stores elements in contiguous memory locations. Elements are accessed using an index number within square brackets.
3. Common array operations include initializing values, accessing individual elements, searching for elements, finding the maximum/minimum value, and performing element-wise operations on multiple arrays.
Call by value or call by reference in C++Sachin Yadav
Call by value means passing the value directly to a function. The called function uses the value in a local variable; any changes to it DO NOT affect the source variable. In call by value method, the called function creates its own copies of original values sent to it. Any changes, that are made, occur on the function’s copy of values and are not reflected back to the calling function.
Call by value or call by reference in C++Sachin Yadav
Call by value means passing the value directly to a function. The called function uses the value in a local variable; any changes to it DO NOT affect the source variable. In call by value method, the called function creates its own copies of original values sent to it. Any changes, that are made, occur on the function’s copy of values and are not reflected back to the calling function.
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
C Programming : Arrays, One Dimensional Arrays, Two Dimensional Arrays, Three Dimensional Arrays, Operations on Arrays like Insertion, Deletion, Searching, Sorting, Merging, Traversing, Matrix Manipulation like Addition, Multiplication etc. : Visit us at : www.rozyph.com
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
C Programming : Arrays, One Dimensional Arrays, Two Dimensional Arrays, Three Dimensional Arrays, Operations on Arrays like Insertion, Deletion, Searching, Sorting, Merging, Traversing, Matrix Manipulation like Addition, Multiplication etc. : Visit us at : www.rozyph.com
At the end of this lecture students should be able to;
Describe the C arrays.
Practice the declaration, initialization and access linear arrays.
Practice the declaration, initialization and access two dimensional arrays.
Apply taught concepts for writing programs.
Introduction of arrays, Declaration of array, Initialization of array, Sorting, Multidimensional array. Some code examples that will make you clear about the concept of arrays.
https://github.com/ashim888/csit-c
This slide explains the conversion procedure from ER Diagram to Relational Schema.
1. Entity set to Relation
2. Relationship set to Relation
3. Attributes to Columns, Primary key, Foreign Keys
1. What is Entity Relationship Model
2. Entity and Entity Set
3. Relationship and Relationship Set
4. Attributes and it's kinds
5. Participation Constraints and Mapping Cardinality
6. Aggregation, Specialization, and Generalization
7. Some Sample ERD models
This note includes the followings:
- Database Create, Drop Operations
- Database Table Create, Drop Operations
- Database Table Alter Operation
- Data insertion
- Data deletion
- Existing data update
- Searching data from data table (showing all record, specific columns, specific rows, column aliasing, sorting data, limiting data, distinct data)
- Aggregate functions
- Group by clause
- Having clause
- Types of table joins
- Table aliasing, Inner Join, Left/Right Join, Self Join
- Subquery operation (scalar subquery, column subquery, row subquery, correlated subquery, derived table)
This note contains some sample MySQL query practices based on the HR Schema database. The practice sections are from the following categories:
- DDL statements
- Basic Select statements
- Aggregate operations
- Join operations
This lecture slide contains:
- Difference between FA, PDA and TM
- Formal definition of TM
- TM transition function and configuration
- Designing TM for different languages
- Simulating TM for different strings
This slide contains,
1) Some terminologies like yields, derives, word, derivation
2) Leftmost and Rightmost derivation
3) Ambiguity checking
4) Parse tree generation and ambiguity checking
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
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.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
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.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
2. Array
• An array is a group of like-typed variables that are
referred to by a common name.
• Arrays of any type (int, char, float, double etc.) can be
created and may have one or more dimensions.
• Arrays form a convenient way to handle groups of
related data.
3. Array Element
• An individual variable in the array is called an array element.
• All the array elements must be of the same type and same
storage class.
• Each array element is referred to by specifying the array name
followed by one or more subscripts, with each subscript
enclosed in square brackets.
• Each subscript must be expressed as a nonnegative integer.
• The value of each subscript can be expressed as an integer
constant, an integer variable or a more complex integer
expression.
4. 1 Dimensional Array
• A one-dimensional array is a list of variables that are
all of the same type and are accessed through a
common name.
• C stores one-dimensional arrays in one contiguous
memory location with the first element at the lowest
address.
5. Declaring 1 D Array
type var_name[size];
• type is a valid C data type.
• var_name is the name of the array.
• size specifies the number of elements in
the array.
6. Declaring 1 D Array
type var_name[size];
• type is a valid C data type.
• var_name is the name of the array.
• size specifies the number of elements in
the array.
int x[100]; ///x is a 100 element integer array
char text[80]; ///text is an 80 element character array
#define SIZE 20
…….
float myarray[SIZE]; ///myarray is a 20 element floating-point array
7. 1 D Array Elements
• 1st element : x[0]
• 2nd element : x[1]
• 3rd element : x[2]
• 5th element : x[4]
int x[5];
⋮
⋮
x[0] x[1] x[2] x[3] x[4]
8. 1 D Array Elements
• 1st element : x[0]
• 2nd element : x[1]
• 3rd element : x[2]
• 5th element : x[4]
int x[5];
⋮
⋮
Element No i Index No i-1
x[0] x[1] x[2] x[3] x[4]
9. 1 D Array Initialization
int x[5] = { 1, 2, 3, 4, 5};
Similarly,
x[0] x[1] x[2] x[3] x[4]
1 2 3 4 5
float arr[6]={0, 0.25, 0, -0.50, 0, 0};
char color[ ]={'R', 'G', 'B'};
• The array size need not be specified explicitly when initial
values are included as a part of an array definition.
• The array size will automatically be set equal to the
number of initial values included within the definition.
10. Assigning Values to Array Elements
int x[5] = { 1, 2, 3, 4, 5};
x[0] x[1] x[2] x[3] x[4]
1 2 3 4 5
x[2] = 7;
13. Problem
• Write a program that will declare a 10 elements array
and saves the value of squares from 1 to 10 to those
10 array elements.
14. Problem
• Write a program that will declare a 10 elements array
and saves the value of squares from 1 to 10 to those
10 array elements.
x[0] x[1] x[2] x[3] x[4]
1 4 9 16 25
x[5] x[6] x[7] x[8] x[9]
36 49 64 81 100
18. Solution
#include<stdio.h>
#define SIZE 10
int main()
{
int sqrs[SIZE], i;
///assigning values to array elements
for(i=0; i<=SIZE-1; i++){
sqrs[i]=(i+1)*(i+1);
}
///showing the values of array elements
for(i=0; i<=SIZE-1; i++){
printf("%d th element: %dn", i, sqrs[i]);
}
return 0;
}
19. scanf for 1 D Array
• Using scanf you can give input values to specific array
elements.
x[0] x[1] x[2] x[3] x[4]
1 2 3 4 5
scanf("%d", &x[2]); ///let, user gives input 100
x[0] x[1] x[2] x[3] x[4]
1 2 100 4 5
20. Sample code
#include<stdio.h>
int main()
{
int arr[10]={1,2,3,4,5,6,7,8,9,10};
int i;
for(i=0;i<10;i+=2){
scanf("%d", &arr[i] );
}
for(i=0;i<10;i++){
printf("%d ", arr[i] );
}
return 0;
}
21. Note
• Single operations
which involve entire
arrays are not
permitted in C.
• So in C, you can’t
assign one entire
array to another.
#include<stdio.h>
int main()
{
int a1[10],a2[10];
int i;
for(i=0;i<10;i++){
scanf("%d", &a1[i] );
}
a2=a1; ///error
return 0;
}
22. Sample code
///sample code to copy one array into another
#include<stdio.h>
int main()
{
int a1[5],a2[5];
int i;
for(i=0;i<5;i++){
scanf("%d", &a1[i] );
}
///can’t write a2=a1;
for(i=0;i<5;i++){
a2[i]=a1[i];
}
///showing outputs
for(i=0;i<5;i++){
printf("%d ",a2[i]);
}
return 0;
}
24. Sample code
#include<stdio.h>
#define SIZE 1000
int main()
{
int arr[SIZE];
int sz,element;
printf("Please enter the number of elements of the array: ");
scanf("%d",&sz);
int i;
for(i=0;i<sz;i++){
scanf("%d",&arr[i]);
}
printf("Please enter the element to search for: ");
scanf("%d", &element);
for(i=0;i<sz;i++){
if(arr[i]==element){
printf("Yes");
break;
}
}
if(i==sz) printf("No");
return 0;
}
25. Problem
• Write a program to find the maximum element of an
array containing positive numbers.
26. Sample code
#include<stdio.h>
#define SIZE 1000
int main()
{
int arr[SIZE];
int sz, max_el=0;
printf("Please enter the number of elements of the array: ");
scanf("%d",&sz);
int i;
for(i=0;i<sz;i++){
scanf("%d",&arr[i]);
}
for(i=0;i<sz;i++){
if(arr[i]>max_el){
max_el=arr[i];
}
}
printf("The maximum value is %dn", max_el);
return 0;
}
27. Problem
• Write a program to save an array in reverse order
into another array.
28. Sample code
#include<stdio.h>
int main()
{
int arr[5]={1,2,3,4,5};
int rev_arr[5];
int i;
for(i=0;i<5;i++){
rev_arr[i]=arr[5-i-1];
}
for(i=0;i<5;i++) printf("%d ",rev_arr[i]);
return 0;
}
29. Problem
• Write a program to calculate the sum of two 1 D
array (element wise) of exactly same size.
30. Sample code
#include<stdio.h>
int main()
{
int a1[5]={1,2,3,4,5};
int a2[5]={5,4,3,2,1};
int sum[5];
int i;
for(i=0;i<5;i++){
sum[i]=a1[i]+a2[i];
}
for(i=0;i<5;i++) printf("%d ",sum[i]);
return 0;
}
31. Problem
• Write a program to right rotate an array. Take input
the amount to rotate right.
32. Sample code
#include<stdio.h>
#define SIZE 7
int main()
{
int arr[SIZE]={1,2,3,4,5,6,7};
int r_rotate;
printf("Enter the amount to rotate right: ");
scanf("%d",&r_rotate);
int i;
for(i=SIZE-1;i>=r_rotate;i--){
arr[i]=arr[i-r_rotate];
}
for(i=0;i<r_rotate;i++){
arr[i]=0;
}
for(i=0;i<SIZE;i++) printf("%d ",arr[i]);
return 0;
}
33. Problem
• Write a program to separate the even and odd
elements of an array into two other arrays.
34. Sample code
#include<stdio.h>
#define SIZE 7
int main()
{
int arr[SIZE]={1, 2, 3, 4, 5, 6, 7};
int even[SIZE],odd[SIZE];
int i,even_sz=0,odd_sz=0;
for(i=0;i<SIZE;i++){
if(arr[i]%2==0){
even[even_sz]=arr[i];
even_sz++;
}
else{
odd[odd_sz]=arr[i];
odd_sz++;
}
}
printf("Even Array: "); ///showing the even numbers
for(i=0;i<even_sz;i++) printf("%d ",even[i]);
printf("nOdd Array: "); ///showing the odd numbers
for(i=0;i<odd_sz;i++) printf("%d ",odd[i]);
return 0;
}