Home » Ask & Discuss » Board Exams - CBSE, ICSE, State Boards » Computer Science « Back to Discussion



Computer Science

SRIKSHADY - Determined & self-motivated for IIT's Avatar
Blazing goIITian

Joined: 19 Jan 2008
Post: 360
23 Mar 2009 21:06:51 IST
0 People liked this
4
366 View Post
(Q.1) What is wrong with the code below ? struct { int x=10; int y; char z[10];
None

(Q.1) What is wrong with the code below ?struct { int x=10; int y; char z[10]; }a1,a2;


Share this article on:

Comments (4)


Cool goIITian

Joined: 19 Feb 2009
Posts: 52
23 Mar 2009 22:50:21 IST
1 people liked this

IF A STRUCTURE IS NOT NAMED,THEN ONLY ONE OBJ CN B CREATED.FOR CREATIN TWO OBJ NAME MUST BE SPECIFIED.DO RATE.
Vikram Saxena's Avatar

Forum Expert
Joined: 1 Apr 2007
Posts: 3732
25 Mar 2009 01:37:47 IST
0 people liked this

we cannot assign values in structure s

int x=10 is not valid
student9_iit's Avatar

Blazing goIITian

Joined: 12 Jan 2008
Posts: 321
25 Mar 2009 01:44:50 IST
0 people liked this

Vikram Saxena is correct you cannot nitialise a data member in the structure so int x=10 is invalid

pankaj's Avatar

Cool goIITian

Joined: 11 May 2009
Posts: 43
11 May 2009 12:41:28 IST
1 people liked this

you should give a tagname to d structure first like:

struct count{......

               .... }

and also u cannot initalise the value of variable in structure




Quick Reply


Reply

Some HTML allowed.
Keep your comments above the belt or risk having them deleted.
Signup for a avatar to have your pictures show up by your comment
If Members see a thread that violates the Posting Rules, bring it to the attention of the Moderator Team
Free Sign Up!

Preparing for IIT-JEE ?

Arihant Revision Package for IIT JEE - Books, Practice Tests + Rank Predictor


@ INR 1,995/-

For Quick Info

Name

Mobile No.

Find Posts by Topics

Physics.

Topics

Mathematics.

Chemistry.

Biology

Parents

Board

Fun Zone

Sponsored Ads