0% found this document useful (0 votes)
27 views

Assignment Lab 2

The document discusses identifiers in C programming, noting that identifiers are names for variables, functions, and other entities and must start with a letter or underscore while being able to include letters, numbers, and underscores. It also differentiates between syntax, which defines the characters used to express concepts, and semantics, which describes the logical concepts and interactions in a programming language.

Uploaded by

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

Assignment Lab 2

The document discusses identifiers in C programming, noting that identifiers are names for variables, functions, and other entities and must start with a letter or underscore while being able to include letters, numbers, and underscores. It also differentiates between syntax, which defines the characters used to express concepts, and semantics, which describes the logical concepts and interactions in a programming language.

Uploaded by

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

ASSIGNMENT

for the complete fulfillment of the requirements for the lab course of

Fundamentals of Computer Programming


Submitted by

HARIS SHAH SYED | CMS ID


Instructor

MR SAAD ALVI

Lab Engineer, Department of Computer Science, National University of Sciences & Technology,
Baluchistan Campus (NBC), Quetta.
IDENTIFIERS
Identifiers are names for entities in a C program, such as variables, arrays, functions, structures,
unions and labels. An identifier can be only of uppercase, lowercase letters, underscore and
digits, but should start only with underscore or an alphabet. The word C cannot be used. It is
called internal if the identifier is not used in external link process. Example: Local variable. If the
identifier is used in an external link process, then it is called as external.

SYNTAX FOR NAMING IDENTIFIERS


A valid identifier can have letters (both uppercase and lowercase letters), digits and
underscores.

The first letter of an identifier should be either a letter or an underscore.

You cannot use keywords as identifiers.

There is no rule on how long an identifier can be. However, you may run into problems in some
compilers if the identifier is longer than 31 characters.

Differentiate between Syntax and Semantics of a


programming language.

Semantics describe the logical entities of a programming language and their interactions.
Syntax defines how these are expressed in characters.
For example, the concept of pointer arithmetic is part of C's semantics; the way the + and -
operators can be used to express pointer operations are part of its syntax.

Sometimes, two languages share part of their semantics, but the syntax differs wildly (e.g. C#
and VB.NET - both use value types and reference types, but the characters you type to define
them are different); in other cases, two languages are syntactically similar.

You might also like