SlideShare a Scribd company logo
C-Data Structure:
Arrays and Strings
Dr. D.H. Kisanga
10 May 2016
1.0 Introduction
 Defn: A data structure is an organized grouping of data items treated
as a unit.
 Data structures helps to minimize the problems associated with sorting
data and with trying to find data elements quickly and easily.
 The principal data structures includes
 arrays
 strings
 record
 lists
 trees
 queues
 stacks
 Access tables.
2.0 Arrays
 Def: An Array is a list of elements that are all of the same data
type and are accessed through a common name.
 Arrays form a convenient way to handle groups of related data.
For e.g. you might want to create a collection of 5 integers.
One way to do it would be to declare 5 integers directly;
int a, b, c, d, e ;
 This is Ok, but what if you needed a thousand integers? An
easier way is to use arrays.
2.1 One-Dimensional Arrays
 Defn: A list of items can be given one variable name using only
one subscript; such a variable is known as a one dimensional array.
 The general form of a 1-D array:
type var-name[size];
Where;
type: is a valid C data type
var-name: is a name of an array
size: specifies the maximum number of elements in the array.
E.g. int mark[4];
(i.e. This is an integer array ‘Mark’ with 4 elements).
 Syntax:
data-type array-name[size] = { list of values };
Where;
list of values is a comma-separated list of constants.
E.g (i). int mark[4] = {54, 61, 62, 70};
Where;
mark [0] = 54;
mark [1] = 61;
mark [2] = 62;
mark [3] = 70;
2.1.1 Initializing a 1-D Array
Eg (ii) char ch[5] = {‘s’, ‘t’, ‘p’, ‘q’, ‘r’};
Where,
ch[0]= ‘s’;
ch[1]= ‘t’;
ch[2]= ‘p’;
ch[3]= ‘q’;
ch[4]= ‘r’;
NB: One of the nice things about array indexing is that you
can use a for loop to handle, manage or manipulate the array.
E.g.1 This program uses a ‘for’ loop to initialize the values in the
array and then display them on a monitor.
#include<stdio.h>
#include<conio.h>
main ( ){
int i, arr [5];
for (i =0; i < 5; i++)
arr[i] = i;
for (i =0; i < 5; i++)
printf("arr[%d] = %d n", i, arr[i]);
getch();
}
E.g. 2. This program declares an array mark as integer and assign values to
it. Next it uses a ‘for’ loop to display them on the monitor.
#include<stdio.h>
#include<conio.h>
main ( )
{
int mark[4] ={ 54, 61, 62, 70};
int i;
for (i = 0; i < 4; i++)
printf ("t mark[%d] = %d n ", i , mark[i] );
getch();
}
Eg 3. This program input 10 numbers entered by the user to an array
and compute their sum.
#include<stdio.h>
#include<conio.h>
main ( ){
int val[10], i, total=0;
printf("Enter any ten numbers: ");
for(i=0; i<10; i++)
scanf("%d", &val[i]); // input numbers
for(i=0; i<10; i++)
total = total + val[i]; // find total
printf("n Total is: %d", total);
getch();
}
2.1.2 Searching an Array
 If we wish to know whether or not a particular value is present within
an array we may find out by conducting a search.
E.g. 1: Write a program to search the element 62 in the array mark given
earlier. Display it when found.
#include<stdio.h>
#include<conio.h>
main ( ){
int i, mark [4] = {54,61,62,70};
for (i = 0; i < 4; i++)
if (62 == mark[i])
printf ("n Element %d found", mark [i]);
getch();
}
Eg 2. Modify Eg 1 above such that 62 is entered from the keyboard.
#include<stdio.h>
#include<conio.h>
main ( )
{
int i, num, mark [4] = {54,61,62,70};
printf("n Given an Array mark[4]= {54,61,62,70}");
printf("nn Enter a number to search a number from an array
mark");
printf("nn You have only 5 chances");
scanf("n%d", &num);
for (i = 0; i < 4; i++)
if (num == mark[i])
printf ("n Element %d found", mark [i]);
else
printf ("n number %d not in the array ", num);
getch();
}
Class Ex:
Q1. Write a program that allows the user to input 10 elements
into an array and then search for any element and display it
when found. If not found display this message, “The number
…….is not in the array.”
2.2 Two-Dimensional Arrays
 Defn: It is simply defined as array of arrays.
The general form of a 2-D array:
type array-name[rows][columns];
E.g. int count [4] [5];
This is a 4x5 2-D integer array
 A 2-D array is accessed a row at a time, from left to right.
• A conceptual view of a 4x5, 2-D array.
Column 0 1 2 3 4
Row
0 [0][0] [0][1] [0][2] [0][3] [0][4]
1 [1][0] [1][1] [1][2] [1][3] [1][4]
2 [2][0] [2][1] [2][2] [2][3] [2][4]
3 [3][0] [3][1] [3][2] [3][3] [3][4]
i
j
Eg1: This program loads a 4x5 array with the product of the
indices, then displays the array in row, column format.
#include<stdio.h>
#include<conio.h>
main ( )
{
int count [4][5];
int i, j;
for (i = 0; i<4; i++)
for (j = 0; j<5; j++)
count[i][j] = i * j;
3.0 Strings
 Def: A String in C is simply an array of characters.
 Any group of characters defined between double quotation marks
is a string constant. Such as –
“This is a C Programming Language.”
 General format of a string array is;
char string_name[size];
Where;
 string_name is the valid variable name given to the string and
 size determines the number of characters in the string.
For Eg.
char city[10];
‘city’ is the character array or a string that can be store10 characters.
char name[30];
‘name’ is an array of characters that can store 30 characters
3.1. Initializing a String
 Like numerical arrays the strings can also be initialized. It can be
done in following three forms:
Eg. char city[8] = “Computer”; or
char city[ ] = “Computer”; or
char city[8] = {‘C’, ‘o’, ‘m’, ‘p’, ‘u’, ‘t’, ‘e’, ‘r’ };
Where;
city[0]=‘C’;
city[1]=‘o’;
:
city[7]=‘r’;
 There are several ways to read a string from the keyboard. One
of them is by using a gets( ) function. (This function also
available in stdio.h)
 To use gets ( ), call it using the name of a character array without
any index.
Eg. This program reads a string entered at the keyboard. It then displays the
contents of that string one character at a time.
#include<stdio.h>
#include<string.h>
#include<conio.h>
main ( ){
char myarr[80];
int i;
printf ("enter a string (less than 80 characters): ");
gets(myarr);
for (i = 0; myarr[i]; i++)
printf ("%c", myarr[i]); /* prints one character at a time */
getch();
}
3.2. String Handling Functions
 C library is supports a large collection of string handling
functions. They are all defined in string.h file.
 The four most important string related functions are:
 strcpy ( )
 strcat ( )
 strcmp ( )
 strlen ( )
(1) The strcpy ( ) : (string copy)
 Its general form is
strcpy (to, from);
 It copies the contents of from to to. The contents of from are
unchanged.
e.g. This fragment copies the string “Hello” into str and
displays it on the screen.
char str [20];
strcpy (str, “Hello”)
N.B: The strcpy ( ) performs no bound checking, so make sure that
the receiving array is large enough to hold what is being copied plus
the null terminator.
(2) The strcat ( ): (string concatenation)
 Its general form is;
strcat (to, from);
 It adds the contents of from to to.
E.g. This fragment copies a string “Hello” to an array ‘str’. Next it
adds the string “there” to str, and hence display “Hello there”.
char str [40];
strcpy (str, “Hello”);
strcat (str,“there”);
printf (str);
N.B: The strcat ( ) performs no bound checking.
(3) The strcmp ( ) (string compare)
 Its general form is,
strcmp (S1, S2);
 It compares two strings. It returns
- zero if the strings are the same.
- Less than zero if S1<S2
- Greater than zero if S1>S2
N.B: The strings are compared in dictionary order. That is;
• a string is less than another when it would appear before the
other in a dictionary
• a string is greater than the other when it would appear after
the other..
• The comparision is not based upon the length of the string.
• The comparision is case-sensitive, lower case character
being greater than uppercase.
E.g. printf(‘%d”, strcmp (“one”, “one”);
This fragment prints 0, because the strings are the same.
(4) The strlen ( ) (string length)
 Its general from is
strlen (str);
• It returns the length, in characters of a string.
• It does not count the null terminator.
e.g. This fragment will display 4 on the screen.
printf(“%d”, strlen (“test”));
Eg. This program request input of two strings, then demonstrates
the four string functions covered earlier.
#include<stdio.h>
#include<string.h>
#include<conio.h>
main ( )
{
char str1[80], str2[80];
int i;
printf ("enter the 1st string: ");
gets (str1);
printf (" enter the 2nd string: ");
gets (str2);
printf("nn * see how long the strings are *nn");
printf ("%s is %d characters long n", str1, strlen(str1));
printf("%s is %d characters long n", str2, strlen (str2));
printf("nn * Compare the strings *n");
i = strcmp(str1, str2);
if (i == 0)
printf ("The strings are equal n");
else if(i<0)
printf ("%s is less than %s n", str1, str2);
else
printf("%s is greater than %sn", str1, str2);
printf("nn * concatenate str2 to end of str1 *nn");
if (strlen(str1) + strlen(str2)<80) /*checking if there is enough
space*/
strcat(str1, str2);
printf ("n%s", str1);
printf("nn * copy str2 to str1*nn");
strcpy (str1,str2);
printf ("n%s %sn", str1,str2);
getch();
}
Thank you for your attention.
Questions

More Related Content

PPTX
ARRAY's in C Programming Language PPTX.
PPTX
MODUL new hlgjg thaybkhvnghgpv7E_02.pptx
PPTX
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
DOCX
PPS 4.4ARRAYS ARRAY DECLARATION & INITIALIZATION, BOUND CHECKING ARRAYS (1-D...
PPT
Array THE DATA STRUCTURE. ITS THE STRUCT
DOC
Arrays and Strings
PDF
Unit 2
PPTX
Diploma ii cfpc u-4 function, storage class and array and strings
ARRAY's in C Programming Language PPTX.
MODUL new hlgjg thaybkhvnghgpv7E_02.pptx
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
PPS 4.4ARRAYS ARRAY DECLARATION & INITIALIZATION, BOUND CHECKING ARRAYS (1-D...
Array THE DATA STRUCTURE. ITS THE STRUCT
Arrays and Strings
Unit 2
Diploma ii cfpc u-4 function, storage class and array and strings

Similar to C-Arrays & Strings (computer programming).pptx (20)

PPTX
Bsc cs i pic u-4 function, storage class and array and strings
PPTX
Btech i pic u-4 function, storage class and array and strings
PDF
Functions torage class and array and strings-
DOCX
Unitii classnotes
PPTX
Mcai pic u 4 function, storage class and array and strings
PPTX
C (PPS)Programming for problem solving.pptx
PPTX
function, storage class and array and strings
PDF
CSEG1001Unit 3 Arrays and Strings
PPTX
Array.pptx
PPTX
C Programming Unit-3
PPT
THE FORMAT AND USAGE OF STRINGS IN C.PPT
PPT
Cfbcgdhfghdfhghggfhghghgfhgfhgfhhapter11.PPT
PPT
Chapterabcdefghijklmnopqrdstuvwxydanniipo
DOCX
Array &strings
PPTX
Arrays
PPTX
Array , Structure and Basic Algorithms.pptx
PPT
Strings
PPTX
Lecture 15_Strings and Dynamic Memory Allocation.pptx
PDF
Unit ii data structure-converted
Bsc cs i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and strings
Functions torage class and array and strings-
Unitii classnotes
Mcai pic u 4 function, storage class and array and strings
C (PPS)Programming for problem solving.pptx
function, storage class and array and strings
CSEG1001Unit 3 Arrays and Strings
Array.pptx
C Programming Unit-3
THE FORMAT AND USAGE OF STRINGS IN C.PPT
Cfbcgdhfghdfhghggfhghghgfhgfhgfhhapter11.PPT
Chapterabcdefghijklmnopqrdstuvwxydanniipo
Array &strings
Arrays
Array , Structure and Basic Algorithms.pptx
Strings
Lecture 15_Strings and Dynamic Memory Allocation.pptx
Unit ii data structure-converted
Ad

Recently uploaded (20)

PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Business Ethics Teaching Materials for college
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
Pharma ospi slides which help in ospi learning
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
From loneliness to social connection charting
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Business Ethics Teaching Materials for college
102 student loan defaulters named and shamed – Is someone you know on the list?
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Insiders guide to clinical Medicine.pdf
O7-L3 Supply Chain Operations - ICLT Program
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Week 4 Term 3 Study Techniques revisited.pptx
Pharma ospi slides which help in ospi learning
human mycosis Human fungal infections are called human mycosis..pptx
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Cardiovascular Pharmacology for pharmacy students.pptx
From loneliness to social connection charting
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Ad

C-Arrays & Strings (computer programming).pptx

  • 1. C-Data Structure: Arrays and Strings Dr. D.H. Kisanga 10 May 2016
  • 2. 1.0 Introduction  Defn: A data structure is an organized grouping of data items treated as a unit.  Data structures helps to minimize the problems associated with sorting data and with trying to find data elements quickly and easily.  The principal data structures includes  arrays  strings  record  lists  trees  queues  stacks  Access tables.
  • 3. 2.0 Arrays  Def: An Array is a list of elements that are all of the same data type and are accessed through a common name.  Arrays form a convenient way to handle groups of related data. For e.g. you might want to create a collection of 5 integers. One way to do it would be to declare 5 integers directly; int a, b, c, d, e ;  This is Ok, but what if you needed a thousand integers? An easier way is to use arrays.
  • 4. 2.1 One-Dimensional Arrays  Defn: A list of items can be given one variable name using only one subscript; such a variable is known as a one dimensional array.  The general form of a 1-D array: type var-name[size]; Where; type: is a valid C data type var-name: is a name of an array size: specifies the maximum number of elements in the array. E.g. int mark[4]; (i.e. This is an integer array ‘Mark’ with 4 elements).
  • 5.  Syntax: data-type array-name[size] = { list of values }; Where; list of values is a comma-separated list of constants. E.g (i). int mark[4] = {54, 61, 62, 70}; Where; mark [0] = 54; mark [1] = 61; mark [2] = 62; mark [3] = 70; 2.1.1 Initializing a 1-D Array
  • 6. Eg (ii) char ch[5] = {‘s’, ‘t’, ‘p’, ‘q’, ‘r’}; Where, ch[0]= ‘s’; ch[1]= ‘t’; ch[2]= ‘p’; ch[3]= ‘q’; ch[4]= ‘r’; NB: One of the nice things about array indexing is that you can use a for loop to handle, manage or manipulate the array.
  • 7. E.g.1 This program uses a ‘for’ loop to initialize the values in the array and then display them on a monitor. #include<stdio.h> #include<conio.h> main ( ){ int i, arr [5]; for (i =0; i < 5; i++) arr[i] = i; for (i =0; i < 5; i++) printf("arr[%d] = %d n", i, arr[i]); getch(); }
  • 8. E.g. 2. This program declares an array mark as integer and assign values to it. Next it uses a ‘for’ loop to display them on the monitor. #include<stdio.h> #include<conio.h> main ( ) { int mark[4] ={ 54, 61, 62, 70}; int i; for (i = 0; i < 4; i++) printf ("t mark[%d] = %d n ", i , mark[i] ); getch(); }
  • 9. Eg 3. This program input 10 numbers entered by the user to an array and compute their sum. #include<stdio.h> #include<conio.h> main ( ){ int val[10], i, total=0; printf("Enter any ten numbers: "); for(i=0; i<10; i++) scanf("%d", &val[i]); // input numbers for(i=0; i<10; i++) total = total + val[i]; // find total printf("n Total is: %d", total); getch(); }
  • 10. 2.1.2 Searching an Array  If we wish to know whether or not a particular value is present within an array we may find out by conducting a search. E.g. 1: Write a program to search the element 62 in the array mark given earlier. Display it when found. #include<stdio.h> #include<conio.h> main ( ){ int i, mark [4] = {54,61,62,70}; for (i = 0; i < 4; i++) if (62 == mark[i]) printf ("n Element %d found", mark [i]); getch(); }
  • 11. Eg 2. Modify Eg 1 above such that 62 is entered from the keyboard. #include<stdio.h> #include<conio.h> main ( ) { int i, num, mark [4] = {54,61,62,70}; printf("n Given an Array mark[4]= {54,61,62,70}"); printf("nn Enter a number to search a number from an array mark"); printf("nn You have only 5 chances"); scanf("n%d", &num);
  • 12. for (i = 0; i < 4; i++) if (num == mark[i]) printf ("n Element %d found", mark [i]); else printf ("n number %d not in the array ", num); getch(); } Class Ex: Q1. Write a program that allows the user to input 10 elements into an array and then search for any element and display it when found. If not found display this message, “The number …….is not in the array.”
  • 13. 2.2 Two-Dimensional Arrays  Defn: It is simply defined as array of arrays. The general form of a 2-D array: type array-name[rows][columns]; E.g. int count [4] [5]; This is a 4x5 2-D integer array  A 2-D array is accessed a row at a time, from left to right.
  • 14. • A conceptual view of a 4x5, 2-D array. Column 0 1 2 3 4 Row 0 [0][0] [0][1] [0][2] [0][3] [0][4] 1 [1][0] [1][1] [1][2] [1][3] [1][4] 2 [2][0] [2][1] [2][2] [2][3] [2][4] 3 [3][0] [3][1] [3][2] [3][3] [3][4] i j
  • 15. Eg1: This program loads a 4x5 array with the product of the indices, then displays the array in row, column format. #include<stdio.h> #include<conio.h> main ( ) { int count [4][5]; int i, j; for (i = 0; i<4; i++) for (j = 0; j<5; j++) count[i][j] = i * j;
  • 16. 3.0 Strings  Def: A String in C is simply an array of characters.  Any group of characters defined between double quotation marks is a string constant. Such as – “This is a C Programming Language.”  General format of a string array is; char string_name[size]; Where;  string_name is the valid variable name given to the string and  size determines the number of characters in the string.
  • 17. For Eg. char city[10]; ‘city’ is the character array or a string that can be store10 characters. char name[30]; ‘name’ is an array of characters that can store 30 characters
  • 18. 3.1. Initializing a String  Like numerical arrays the strings can also be initialized. It can be done in following three forms: Eg. char city[8] = “Computer”; or char city[ ] = “Computer”; or char city[8] = {‘C’, ‘o’, ‘m’, ‘p’, ‘u’, ‘t’, ‘e’, ‘r’ }; Where; city[0]=‘C’; city[1]=‘o’; : city[7]=‘r’;
  • 19.  There are several ways to read a string from the keyboard. One of them is by using a gets( ) function. (This function also available in stdio.h)  To use gets ( ), call it using the name of a character array without any index.
  • 20. Eg. This program reads a string entered at the keyboard. It then displays the contents of that string one character at a time. #include<stdio.h> #include<string.h> #include<conio.h> main ( ){ char myarr[80]; int i; printf ("enter a string (less than 80 characters): "); gets(myarr); for (i = 0; myarr[i]; i++) printf ("%c", myarr[i]); /* prints one character at a time */ getch(); }
  • 21. 3.2. String Handling Functions  C library is supports a large collection of string handling functions. They are all defined in string.h file.  The four most important string related functions are:  strcpy ( )  strcat ( )  strcmp ( )  strlen ( )
  • 22. (1) The strcpy ( ) : (string copy)  Its general form is strcpy (to, from);  It copies the contents of from to to. The contents of from are unchanged. e.g. This fragment copies the string “Hello” into str and displays it on the screen. char str [20]; strcpy (str, “Hello”)
  • 23. N.B: The strcpy ( ) performs no bound checking, so make sure that the receiving array is large enough to hold what is being copied plus the null terminator. (2) The strcat ( ): (string concatenation)  Its general form is; strcat (to, from);  It adds the contents of from to to.
  • 24. E.g. This fragment copies a string “Hello” to an array ‘str’. Next it adds the string “there” to str, and hence display “Hello there”. char str [40]; strcpy (str, “Hello”); strcat (str,“there”); printf (str); N.B: The strcat ( ) performs no bound checking.
  • 25. (3) The strcmp ( ) (string compare)  Its general form is, strcmp (S1, S2);  It compares two strings. It returns - zero if the strings are the same. - Less than zero if S1<S2 - Greater than zero if S1>S2
  • 26. N.B: The strings are compared in dictionary order. That is; • a string is less than another when it would appear before the other in a dictionary • a string is greater than the other when it would appear after the other.. • The comparision is not based upon the length of the string. • The comparision is case-sensitive, lower case character being greater than uppercase. E.g. printf(‘%d”, strcmp (“one”, “one”); This fragment prints 0, because the strings are the same.
  • 27. (4) The strlen ( ) (string length)  Its general from is strlen (str); • It returns the length, in characters of a string. • It does not count the null terminator. e.g. This fragment will display 4 on the screen. printf(“%d”, strlen (“test”));
  • 28. Eg. This program request input of two strings, then demonstrates the four string functions covered earlier. #include<stdio.h> #include<string.h> #include<conio.h> main ( ) { char str1[80], str2[80]; int i; printf ("enter the 1st string: "); gets (str1); printf (" enter the 2nd string: "); gets (str2);
  • 29. printf("nn * see how long the strings are *nn"); printf ("%s is %d characters long n", str1, strlen(str1)); printf("%s is %d characters long n", str2, strlen (str2)); printf("nn * Compare the strings *n"); i = strcmp(str1, str2); if (i == 0) printf ("The strings are equal n"); else if(i<0) printf ("%s is less than %s n", str1, str2); else printf("%s is greater than %sn", str1, str2);
  • 30. printf("nn * concatenate str2 to end of str1 *nn"); if (strlen(str1) + strlen(str2)<80) /*checking if there is enough space*/ strcat(str1, str2); printf ("n%s", str1); printf("nn * copy str2 to str1*nn"); strcpy (str1,str2); printf ("n%s %sn", str1,str2); getch(); }
  • 31. Thank you for your attention. Questions

Editor's Notes

  • #23: Criterion validity is also divided into two: Concurrent validity refers to a comparison between the measure in the question and an outcome assessed at the same time. Predictive validity compares the scale in question with an outcome assessed at a later time (Wikipedia)].