Programming and Computer Application Practices: Wildan Aghniya 17063048
Programming and Computer Application Practices: Wildan Aghniya 17063048
Programming and Computer Application Practices: Wildan Aghniya 17063048
“STRING”
By:
Wildan Aghniya
17063048
FACULTY OF ENGINEERING
2019
Purpose
Short Theory
String is a form of data commonly used in programming languages for the purpose of
accommodating and manipulating text data, for example to store (save) a sentence. In C
language, strings are not a separate data type, but rather a collection of sequential character
values in the form of an array with one dimension.
Result
1.
2.
3.
4.
5.
Analysis
The program above, using some function form C language.
Input data string in variables can we do with the function gets() atau scanf().
Function strcpy() to copy the value of string
Function strlen() to know the Value Length of the string
Function strcat() for mergestring value
Function strcmp() for combine two values string
Function strrchr() for stop and return the address of the last character found.
Conclusion
Before you can work with strings, you need to declare them first. Since string is an
array of characters. You declare strings in a similar way like you do with arrays.
You can use the scanf() function to read a string.
You can use gets() function to read a line of string. And, you can use puts() to display the
string.
Strings can be passed to a function in a similar way as arrays.
To manipulated string, we can used function:
- strlen() - calculates length of a string
- strcpy() - copies a string to another
- strcmp() - compares two strings
- strcat() - concatenates two strings
references
Jobsheet
https://www.programiz.com/c-programming/c-string-examples