Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

one doubt in C Quiz

This is a discussion on one doubt in C Quiz within the C and C++ forums, part of the Software Development category; I am having doubt in one question in C quiz. How is a structure variable named as test declared for a structure named as struct exforsys? My answer was struct ...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 07-09-2007
Junior Member
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Avaited is on a distinguished road
one doubt in C Quiz

I am having doubt in one question in C quiz.

How is a structure variable named as test declared for a structure named as struct exforsys?

My answer was struct exforsys test; and system's answer was exforsys test;

in gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) , if you do not used #typedef then u need to write struct before any structure.

Can anyone can clearify it.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-12-2007
Junior Member
 
Join Date: Dec 2007
Location: Hyderabad
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
vikaskr1986 is on a distinguished road
Re: one doubt in C Quiz

As per my views,
as the structure type variable exforsys has been already defined as a structure variable so it doesnt needs to define it again for creating its own variable...
Reply With Quote
  #3 (permalink)  
Old 12-13-2007
Junior Member
 
Join Date: Dec 2007
Location: New DElhi
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Ruchika.Bohra is on a distinguished road
Re: one doubt in C Quiz

it can only be done if exforsys is already defined as a structure thn no need to define it as struct again.
Reply With Quote
  #4 (permalink)  
Old 12-22-2007
Contributing Member
 
Join Date: Dec 2007
Posts: 48
Thanks: 1
Thanked 8 Times in 7 Posts
sk_seeker is on a distinguished road
Re: one doubt in C Quiz

Quote:
Originally Posted by Avaited View Post
I am having doubt in one question in C quiz.

How is a structure variable named as test declared for a structure named as struct exforsys?

My answer was struct exforsys test; and system's answer was exforsys test;

in gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) , if you do not used #typedef then u need to write struct before any structure.

Can anyone can clearify it.
With the details you have given, you are absolutely right in that without a typedef, there is no way that we can skip the struct in most C compilers. Infact, even if the fancy compiler allowed you to do that, the compiler has to be backward compatible with standard C programming conventions and thus your answer cannot be wrong.
Reply With Quote
  #5 (permalink)  
Old 12-22-2007
Junior Member
 
Join Date: Dec 2007
Location: india
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
srinivasneeluri is on a distinguished road
Re: one doubt in C Quiz

Quote:
Originally Posted by avaited View Post
i am having doubt in one question in c quiz. How is a structure variable named as test declared for a structure named as struct exforsys? my answer was struct exforsys test; and system's answer was exforsys test; in gcc (gcc) 3.4.3 20041212 (red hat 3.4.3-9.el4) , if you do not used #typedef then u need to write struct before any structure. Can anyone can clearify it.
ans:- i know ur dout, its very common. To clear ur dout read yashwant kanetkar...
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
New Online Quiz Module - Yes its LIVE now!!! Lokesh M Site News & Announcements 5 07-28-2009 09:27 AM
Quiz Section admin Suggestions & Feedback 5 07-15-2007 03:43 AM
Latest Quiz in Geek Online Testing Lokesh M Site News & Announcements 0 05-19-2007 07:11 AM
Quiz Competetion Jim.Anderson Suggestions & Feedback 4 11-02-2006 09:12 AM
Quiz Competition admin Site News & Announcements 2 10-04-2006 08:14 PM


All times are GMT -4. The time now is 09:54 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved