0% found this document useful (0 votes)
6 views10 pages

Group 7 (2

Uploaded by

malikhassan5156
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views10 pages

Group 7 (2

Uploaded by

malikhassan5156
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Syntax Rules and

Data Types
GC University Faisalabad-Chiniot Campus
Subject: Programming Fundamentals
Instructor: Miss Iqra Fatima

Group No. 7
M. Fawad Aamir
Ali Raza
Introduction

What is Programming?
Defining programming as a process of instructing a computer to
perform specific tasks.

Why Syntax and Data Types Matter


 Emphasize the importance of correct syntax for error-free
code.
 Data types is a container which holds the data, like of you
want to store integer value then use int, if you want to put
value like any name then use string, char, etc.. Data types are
needed so that the compiler can know how the data will be
used.
Syntax Rules
Definition
The set of rules governing the structure
of a programming language.
Key Components of Syntax
Keywords: Reserved words with specific meanings (e.g., if,
else, for, while).
Identifiers: Names given to variables, functions, and other
entities.
Operators: Symbols used to perform operations (e.g., +, -, *, /).
Punctuators: Symbols used to separate parts of code (e.g., ;,
(, ), {}).
Common Syntax Errors

1) Missing semicolons

2) Incorrect indentation

3) Typos and spelling errors


Data Types
Definition
Classification of data based on its nature and
the operations that can be performed on it.
Primitive Data Types
Integer: Whole numbers (e.g., 10, -5, 0)
Floating-Point: Real numbers with decimal
points (e.g., 3.14, -2.5)
Character: Single characters (e.g., 'a', 'Z', '$')
Boolean: Logical values (true or false)
Derived Data
Types

•Arrays: Collections of elements of the same data type.

•Strings: Sequences of characters.

•Structures: User-defined data types that group variables of different data types.

•Pointers: Variables that store memory addresses.


Type Declaration and Casting
Declaration
 Assigning a data type to a variable.
 Example: int age = 25;

Type Casting
 Converting one data type to another.

Implicit Casting
 Automatic conversion (e.g., int to float).
Explicit Casting
 Manual conversion using type conversion
operators (e.g., (int) 3.14).
Practical Examples
Code Snippets
 Demonstrate syntax rules and data types in a
specific programming language (e.g., Python, C+
+, Java).
 Highlight the correct usage of keywords,
operators, and data types.
Real-World Applications
 Discuss how different data types are used in
various fields (e.g., scientific simulations, data
analysis, game development).
Final Thoughts

Mastering syntax and understanding


data types lay a strong foundation
for programming in any language.
The END

You might also like