What is the Structure or Format of Data Called?

The structure or format of data is called the Syntax, which is defined by various combinations of pre-defined symbols in a programming language.
Transform Your Career
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
What is Syntax?
A Syntax in a programming language is the set of rules that defines a particular language, by defining the correct arrangements of the symbols which are pre-defined in a particular language eg: ";" , "->" , and the keywords like "int" , "float" etc.
Example
We have to declare a variable x and initialize it with an integer value of 4.
Statement 1 : 4 int; = x
Statement 2 : int x = 4;
Statement 1 is not correct in terms of syntax, but Statement 2 is correct. This is because, in the C++ language (like in any other programming language), we have a pre-defined set of rules, and if these rules are not followed, the compiler will generate errors. So according to C++, if we want to declare a variable and initialize it with some value, we must follow the syntax according to Statement 2.
What is Semantics?
While we know that syntax is the pre-defined set of rules which defines a particular language, semantics refers to the logic of the code which we have written according to the problem we are solving. Given below are some examples.
Example
Given two numbers x and y, we have to calculate their product.
Statement 1: int product = x+y;
Statement 2: int product = x-y;
Statement 3: int product = x*y;
All the Statements written above are correct in terms of syntax, but the logic of Statement 1 and Statement 2 is incorrect because we have to find the product of x and y, but in Statement 1 we have calculated the sum and in Statement 2 we have calculated the difference, so the only correct statement according to the problem is Statement 3.
Syntax Error
Syntax error as the name suggests is the error in the syntax of a statement of a program written by a programmer. In simple words we can say, Syntax errors are the mistakes in the source code, caused by incorrect spelling or incorrect symbols which are not defined in the programming language, and sometimes syntax errors can be as small as a single character mistake.
Example 1
If we write the above code in C++, it will show the following syntax error
This syntax error is clearly saying that we need to put a ';' (semicolon) after the statement cout << "Hello World!" to make this code correct.
So now after making changes, this code will run fine.
Output:
Below is another example
Example 2
Output:
This syntax error is clearly saying that we need to put a ')' (closed parenthesis) to match this '(' (open parenthesis).
So now after making changes, this code will run fine.
Output:
Scaler Placement Report and Statistics
Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.
Difference between Syntax and Semantics
| Syntax | Sementics |
|---|---|
| It refers to the set of rules and regulations that helps to write a statement in any programming language | It refers to the meaning associated with the statement written in a programming language |
| Syntax errors are found by the compiler after the program has been completely executed. | Semantic errors can be found during the runtime because if our answer is wrong, there must be some logical mistake |
| Syntax errors can be found easily because the compiler immediately finds the syntax errors and the line in which the error has occurred | Semantic errors are sometimes very difficult to find, because sometimes in a large code, it is difficult to find a small logical mistake |
| Example: missing semicolon, missing parenthesis, wrong spelling of keywords | Example: We want to calculate x+y but by mistake we put '-' (minus) sign instead of '+' (plus) sign, so our answer will be wrong |
Conclusion
In this quick tutorial, we learned the following
- We answered the question What is the Structure or Format of Data called?
- We learned what syntax and semantics is
- We learned what syntax error is with examples
- Finally, we saw the difference between syntax and semantics with examples




