The document discusses arrays and strings in C programming. It defines arrays as groups of data items of the same type that share a common name. One-dimensional arrays are declared with a datatype and size, and can be initialized. Multi-dimensional arrays have multiple subscripts. Strings are arrays of characters that are null-terminated. Strings can be initialized and manipulated using functions like strcpy(), strlen(), strcmp(). Examples are provided to demonstrate array and string declarations, initialization, manipulation and differences between the two data structures.
A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings.
1.Bitwise operators
2. Introduction to Bitwise Operators
3. Types of Bitwise Operators
4. Uses of Bitwise Operators
5. Coding example of one of the bitwise operator.
6. Output after executing program using bitwise operator.
7. Thank You
A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings.
1.Bitwise operators
2. Introduction to Bitwise Operators
3. Types of Bitwise Operators
4. Uses of Bitwise Operators
5. Coding example of one of the bitwise operator.
6. Output after executing program using bitwise operator.
7. Thank You
Constructors, Destructors, call in parameterized Constructor, Multiple constructor in a class, Explicit/implicit call, Copy constructor, Dynamic Constructors and call in parameterized Constructor
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.
Homework Assignment – Array Technical DocumentWrite a technical .pdfaroraopticals15
Homework Assignment – Array Technical Document
Write a technical document that describes the structure and use of arrays. The document should
be 3 to 5 pages and include an Introduction section, giving a brief synopsis of the document and
arrays, a Body section, describing arrays and giving an annotated example of their use as a
programming construct, and a conclusion to revisit important information about arrays described
in the Body of the document. Some suggested material to include:
Declaring arrays of various types
Array pointers
Printing and processing arrays
Sorting and searching arrays
Multidimensional arrays
Indexing arrays of various dimension
Array representation in memory by data type
Passing arrays as arguments
If you find any useful images on the Internet, you can use them as long as you cite the source in
end notes.
Solution
Array is a collection of variables of the same type that are referenced by a common name.
Specific elements or variables in the array are accessed by means of index into the array.
If taking about C, In C all arrays consist of contiguous memory locations. The lowest address
corresponds to the first element in the array while the largest address corresponds to the last
element in the array.
C supports both single and multi-dimensional arrays.
1) Single Dimension Arrays:-
Syntax:- type var_name[size];
where type is the type of each element in the array, var_name is any valid identifier, and size is
the number of elements in the array which has to be a constant value.
*Array always use zero as index to first element.
The valid indices for array above are 0 .. 4, i.e. 0 .. number of elements - 1
For Example :- To load an array with values 0 .. 99
int x[100] ;
int i ;
for ( i = 0; i < 100; i++ )
x[i] = i ;
To determine to size of an array at run time the sizeof operator is used. This returns the size in
bytes of its argument. The name of the array is given as the operand
size_of_array = sizeof ( array_name ) ;
2) Initialisg array:-
Arrays can be initialised at time of declaration in the following manner.
type array[ size ] = { value list };
For Example :-
int i[5] = {1, 2, 3, 4, 5 } ;
i[0] = 1, i[1] = 2, etc.
The size specification in the declaration may be omitted which causes the compiler to count the
number of elements in the value list and allocate appropriate storage.
For Example :- int i[ ] = { 1, 2, 3, 4, 5 } ;
3) Multidimensional array:-
Multidimensional arrays of any dimension are possible in C but in practice only two or three
dimensional arrays are workable. The most common multidimensional array is a two
dimensional array for example the computer display, board games, a mathematical matrix etc.
Syntax :type name [ rows ] [ columns ] ;
For Example :- 2D array of dimension 2 X 3.
int d[ 2 ] [ 3 ] ;
A two dimensional array is actually an array of arrays, in the above case an array of two integer
arrays (the rows) each with three elements, and is stored row-wise in memory.
For Example :- Program to fill .
An array is a group of data items of same data type that share a common name. Ordinary variables are capable of holding only one value at a time. If we want to store more than one value at a time in a single variable, we use arrays.
An array is a collective name given to a group of similar variables. Each member in the group is referred to by its position in the group.
Arrays are alloted the memory in a strictly contiguous fashion. The simplest array is a one-dimensional array which is a list of variables of same data type. An array of one-dimensional arrays is called a two-dimensional array.
● Introduction to Arrays
● Declaration and initialization of one dimensional and two-dimensional
arrays.
● Definition and initialization of String
● String functions
In this slide i discuused about Landslide and avalanche. what are the types , causes , effects and how to minimize such disaster.
i also published 2 different videos more understanding.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
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.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Chapter 3 - Islamic Banking Products and Services.pptx
Array and string
1. Dr. S. & S.S. Gandhy Government College of
Engineering and Technology
SEM:- 1ST
SUBJECT:- COMPUTER PROGRAMMING AND UTILIZATION
TOPIC:- ARRAY AND STRING
STUDENT’S NAME:-
PRATIK B. PATEL
PRASHANT A. CHELANI
VIJAY D. VADHER
NIKHIL R. PATIL
2. ARRAY :-
NEED OF ARRAY
ARRAY CONCEPT
DECLARATION OF ONE-
DIMENTIONAL ARRAY
INITIALIZATION OF ONE-
DIMENTIONAL ARRAY
MULTYDIMENSIONAL ARRAY
3. NEED OF ARRAY:
It is very difficult to write a
program in ‘C’ which consisting
large data items like addition of
50 integers, marks of student in
University, etc.
‘C’ program provides a solution
called ‘ARRAY’.
By using array, it is easy to
include large numbers of data
items.
4. ARRAY CONCEPT:-
An array is a group of data items of
the same data type that share a
common name.
An array should be of same datatype
and consists of integers or strings and
so on.
An array is linear and homogeneous.
An array stores the data elements in
sequential order.
Homogeneous means all data items
are of same datatype.
5. Elements of array are specifying a
subscript.
A subscript is also called index.
Subscipt is start from 0 and cannot
negative.
There are two types of array.
1). One-dimentional arrays(also called
vectors)
2). Multi-dimentional arrays(also called
Matrix)
6. DECLARATION OF ONE-
DIMENTIONAL ARRAY:-
Syntex: datatype arrayname[size]
Where,
datatype:- The type of the data stored in the
array
Arrayname:- Name of the array
Size:- Maximum number of elements an array
can hold
Example:- int marks[10]
Mark[0] Mark[1] ………….. ………..... Mark[9]
7. INITIALIZATIONOF ONE-DIMENTIONAL
ARRAY
Int mark[6]={3,7,8,4,5,6}
Is also equel to
Int mark[]={3,7,8,4,5,6}
It will occupy in memory like,
a[0] a[1] a[2] a[3] a[4] a[5]
Char a[8]={‘L’,’E’,’A’,’R’,’N’,’’,’C’}
a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7]
When compiler sees a character array, it add a null
character.So, while declaring a character array, we
must allow one extra element space for null character.
3 7 8 4 5 6
‘L’ ‘E’ ‘A’ ‘R’ ‘N’ ‘’ ‘C’ ‘0’
8. MULTYDIMENSIONAL ARRAY
If an array have more than one dimension, is called
multi-dimensional array.
Two dimensional array have two subscript, three
dimensional array have three subscript.
Declaration of two dimensional array:-
Int a[2][3]
It consist of two rows and three colomns.
a[0][0] a[0][1] a[0][2] a[1][0] a[1][1] a[1][2]
1 2 3 4 5 6
12. INTRODUCTION :-
Strings are array of characters i.e. they are
characters arranged one after another in
memory. Thus, a character array is called
string.
Each character within the string is stored
within one element of the array
successively.
A string is always terminated by a null
character (i.e. slash zero 0).
13. A string variable is declared as an
array of characters.
Syntax:
char string_name[size];
E.g. char name[20];
When the compiler assigns a character
string to a character array, it
automatically supplies a null character
(‘0’) at the end of the string
14. Initializing String
Variables
Strings are initialized in either of the following two forms:
char name[4]={‘R’,‘A’,‘M’, ‘0’};
char name[]={‘R’,‘A’,‘M’, ‘0’};
OR
char name[4]=“RAM”;
char name[]=“RAM”;
When we initialize a character array by listing its
elements, the null terminator or the size of the array must
be provided explicitly.
R A M 0
name[0] name[1] name[2] name[3]
15. Reading and displaying Strings
It can be done manually.
Using printf() and scanf().
Using gets() and puts().
18. String handling functions
strcpy ( ) Copies str2 into str1
strlen ( ) Gives the length of str1
strcmp ( ) Returns 0 if str1 is same as
str2. Returns <0 if strl <
str2. Returns >0 if str1 > str2
strcmpi ( ) Same as strcmp() function. But,
this function negotiates case. “A”
and “a” are treated as same.
strdup ( ) Duplicates the string
strlwr ( ) Converts string to lowercase
strupr ( ) Converts string to uppercase
strrev ( ) Reverses the given string
19. Program to find string length using
function
SOURCE CODE OUTPUT
21. DIFFERECE BETWEEN ARRAY AND
STRING
ARRAY STRING
An array can hold any data type. String can hold only char data
An array size can not be A string size can be changed if it
is a char pointer
The last element of an array is an
element of the specific type.
The last character of a string is a
null – ‘0’ character.
The length of an array is to
specified in [] at the time of
declaration (except char[]).
The length of the string is the
number of characters + one (null
character).