473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is C a block structured language?

AmberJain
884 Expert 512MB
HELLO,

First of all, I accept that this is a too simple question but I got different opinions in different books and so I'm posting it here......

The question is simple.....Is C a block structured language?

But the answers by different authors differ like a pendulum (some say YES while others say NO to this question)

For example.........

Herbert schildt in "C++-Complete reference" says-->
In your previous programming experience, you may have heard the term block-
structured applied to a computer language. Although the term block-structured
language does not strictly apply to C, C is commonly referred to simply as a
structured language. It has many similarities to other structured languages, such
as ALGOL, Pascal, and Modula-2.
The reason that C (and C++) is not, technically, a block-structured language is that
block-structured languages permit procedures or functions to be declared inside
other procedures or functions. Since C does not allow the creation of functions
within functions, it cannot formally be called block-structured.

Another book said simply----->
"C is block structured language"

My C faculty said--->
C is not block structured languges



In many other books and tutorials, I found similar answers.
So please tell me whether C is a block structured language?

THANKS in advance.........
Jul 23 '08 #1
1 9596
weaknessforcats
9,208 Expert Mod 8TB
OK. Here goes.

C is a blocked structured language.

C++ is to replace C.

Therefore, C++ is also a blocked structured language.

Now C++ does have some OO features (which you don't have to use) but even if you do, the program is still block structured. It's just that you don't need to code all of the block calls yourself like you would have to do in C.

An object-oreinted language ahs to support the Liskow Substitution Principle. This principle says a derived object can be substituted for a base object and thereafter when treated as a base object behaves like the derived object that it really is.

You cannot do this in C++. The most you can do is substitute the address of a derived objec as the address of a base object but you cannot substitute the object itself. In this sense C++ is not object-oriented.

However, the address substitution is usually enough to accomplish the same end as substituting th actual object so in that sense you can say that C++ can be object-oriented.

Please note that that a C++ program has calls made by the compiler to accomplish the object-oriented magic. Were you to have a C program, you could make those calls yourself and have an object-oriented program in C.

Note that block structured does not always mean defining procedures within procedures but also means using procedures wirthin procedures. Neither C nor C++ permits defining a procedure within a procedure but you can certainly use procedures within procedures.
Jul 23 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
5
by: John Perks and Sarah Mount | last post by:
When handling resources in Python, where the scope of the resource is known, there seem to be two schools of thought: (1) Explicit: f = open(fname) try: # ... finally: f.close()
2
by: Ganesh | last post by:
Hi, I have some general questions about structured programming. I am trying to understand how the programs look like without structured programming? What constitute a structured program? How has...
3
by: _link98 | last post by:
Running DB2 ESE V8.1.8 on WinXP. This is Fixpak 8. Have a structured-type and some methods for that type. One of my methods needs to do insert / update on tables. The type specification...
3
by: ambika | last post by:
Hello, I have a very basic doubt. Why is C called a structured programming language??why structured? C++ is called a Object Oriented language 'cos it obeys the OOP's concepts..Why is C called a...
7
by: seamoon | last post by:
Hi, I'm doing a simple compiler with C as a target language. My language uses the possibility to declare variables anywhere in a block with scope to the end of the block. As I remembered it this...
2
by: Julio C. Hernandez Castro | last post by:
Dear all, We have just developped a new block cipher called Raiden, following a Feistel Network structure by means of genetic programming. Our intention now consists on getting as much feedback...
2
by: vectorizor | last post by:
Hi all, I am writing an image processing algorithm that goes across an image first row-wise and then column-wise. For illustration purposes, imagine that for every pixels, the output is computed...
14
by: barcaroller | last post by:
I have a multi-field struct and a memory block (created using malloc) that contains structured data. If I map the struct to the memory block, am I guaranteed that the struct fields will be filled...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.