IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C++ Programming C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Civil Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C Programming - Typedef - Discussion

@ : Home > C Programming > Typedef > Find Output of Program - Discussion

Read more:

"You cannot shake hands with a clenched fist."
- Indira Gandhi
5. 

What will be the output of the program?

#include<stdio.h>

typedef struct error {int warning, err, exception;} ERROR;
int main()
{
    ERROR e;
    e.err=1;
    printf("%d\n", e.err);
    return 0;
}

[A]. 0[B]. 1
[C]. 2[D]. Error

Answer: Option E

Explanation:

No answer description available for this question.


Varad said: (Fri, Mar 25, 2011 04:10:12 AM)    
 
any one help me for this problem plzz...

Saravanan.C said: (Mon, May 16, 2011 07:10:24 AM)    
 
typedef struct error
{
int warning;
int err;
int exception;
}ERROR;

This is how this normally looks....

Here a structure named error is typedefed as ERROR(means in place of struct error it can be said as ERROR)...
then e is a structure..
e.err is accessing a member in the structure... thats it.... is it correct......?

Sathya said: (Mon, Jan 9, 2012 06:28:29 PM)    
 
In c how can u create an object like ERROR e; ? Is it correct?

Instead of using e.err , why cant we simply use ERROR.err?

Nagaraj said: (Thu, Feb 23, 2012 03:12:49 PM)    
 
Hey in the structure, how can we declare like that ?

Every variablemust be declared separately, am I right?

Shreyas said: (Sun, Oct 7, 2012 04:00:14 PM)    
 
@ Sathya
We are Typedefin the structure error to ERROR.
Therefore ERROR is acting like struct error.
ERROR e; is the same as struct error e;

Write your comments here:
Name *:     Email:


© 2008-2013 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Contact us: info@indiabix.com     Follow us on twitter!