How programming languages work with datatypes

Han sang yeob·2021년 2월 10일
0

Basic of C language

목록 보기
6/9

Let's imagine we open up your computer and we look at your memory and we see a stream of ones and zeros. How can you know whether it is referring to a number of text or maybe it's part of a music file?? You can not. The same binary that means one thing if it is a number could mean something entirely different if it is part of a music file. That is why you must be specific in any program you write and state what type of data you are working with.
Whenever you are writing a program and you are going to be using data you must always specify what kind of data it is that you are working with. For example, if you are planning on having someone type text on their keyboard as part of your program then you need to tell the programming language that the type of data you expect to work with is text. If you are doing addition on numbers then you need to tell the program that the type of data you expect to work with our numbers. Every programming language has a slightly different way of doing this. However, some things tend to be nearly Universal. Concerning text, you will usually place the text inside of either single quotes or double quotes

"Text usually looks like this"
'or this'

By putting your text within quotes you're basically telling your programming language that you are working with text. Now if you are working with numbers, typically you don't have to put the numbers inside of quotes. So using quotes is one example of how you specify what kind of data you are working with.
Now, there are many different kinds of data and this is just one example.
This is what we call syntax. Syntax in any programming language refers to the specific way in which you use that particular programming language. For example, using quotes in the text is an example of the syntax and it's true in many programming languages but not all programming languages.

profile
Learning IT in Vietnam

1개의 댓글

comment-user-thumbnail
2021년 2월 22일

Making money should be a number one priority for people. Some jobs are very boring, but what if I told you that earning cash can be very entertaining. Just go here for further information. I hope you will like it as well. Good luck with money income.

답글 달기