468,514 Members | 1,678 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,514 developers. It's quick & easy.

c can protect the data in struct

c language can protect the data in scopes private,protected and
public(may be) in structure and union?
Feb 27 '08 #1
6 2025
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
i studied in trichy LINSOFT. He teach this program.
Feb 27 '08 #3
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
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
>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
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.

Similar topics

6 posts views Thread by YK | last post: by
11 posts views Thread by siliconmike | last post: by
31 posts views Thread by aarklon | last post: by
22 posts views Thread by teejayem | last post: by
8 posts views Thread by Mike | last post: by
3 posts views Thread by jacob navia | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.