By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,457 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,457 IT Pros & Developers. It's quick & easy.

c can protect the data in struct

P: n/a
c language can protect the data in scopes private,protected and
public(may be) in structure and union?
Feb 27 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
satheesh wrote:
c language can protect the data in scopes private,protected and
public(may be) in structure and union?
No it can't. It can be hidden from direct access from an outer scope or
from another translation unit, but nothing anywhere in a C program's
address space can be absolutely protected from any other part of
itself.

Maybe you can clarify your question?

Feb 27 '08 #2

P: n/a
i studied in trichy LINSOFT. He teach this program.
Feb 27 '08 #3

P: n/a
On Wed, 27 Feb 2008 08:00:34 -0600, satheesh wrote
(in article
<8b**********************************@u10g2000prn. googlegroups.com>):
i studied in trichy LINSOFT. He teach this program.
"He" is wrong. C does not have these features. Compiling code that is
/claimed/ to be C with a C++ compiler doesn't make it true.
--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Feb 27 '08 #4

P: n/a
satheesh wrote:
c language can protect the data in scopes private,protected and
public(may be) in structure and union?
C has no "private" or "protected" or "public" scope.
Are you thinking of some other language?

--
Eric Sosman
es*****@ieee-dot-org.invalid
Feb 27 '08 #5

P: n/a
>c language can protect the data in scopes private,protected and
>public(may be) in structure and union?
No. There are no scopes private, protected and public in C.

You are looking for C++. And C++ cannot really protect (as in
prevent access) either. The protection only works if everyone obeys
the rules. All you have to do is invoke the wrath of undefined
behavior, often by loading up a pointer with something illegal, and
then using it.

Feb 28 '08 #6

P: n/a
On Feb 28, 9:22*am, gordonb.6e...@burditt.org (Gordon Burditt) wrote:
clanguagecan protect the data in scopes private,protected and
public(may be) in structure and union?

No. *There are no scopes private, protected and public inC.

You are looking for C++. *And C++ cannot really protect (as in
prevent access) either. *The protection only works if everyone obeys
the rules. *All you have to do is invoke the wrath of undefined
behavior, often by loading up a pointer with something illegal, and
then using it.
In C There is no Private, Public,protected so there is no case of
protection.
in C++ There is Private ,Public Protected. If you follows rules it is
protected . if you are not following you still can access Private Data
even in C++.
Mar 12 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.