GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 380 of 453    Print  
What is the difference between typedef & Macros?

  
Total Answers and Comments: 1 Last Update: October 11, 2007     Asked by: Deepak 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 11, 2007 10:32:11   #1  
mani2881 Member Since: July 2007   Contribution: 5    

RE: What is the difference between typedef & Macros?
Typedef is used to create a new name to an already existing data type. Redefine the name creates conflict with the previous declaration.

eg:
typedef unsigned int UINT32

Macros [#define] is a direct substitution of the text before compling the whole code. In the given example its just a textual substitution. where there is a posibility of redifining the macro

eg:
#define chPointer char *
#undef chPointer
#define chPointer int *

 
Is this answer useful? Yes | No

 Related Questions

A goto statement implements a local jump of program execution, and the longjmp() and setjmp() functions implement a nonlocal, or far, jump of program execution. Generally, a jump in execution of any kind 
Latest Answer : using the normal goto statement we can move only within the function. it is not possible to go from one function to another function.using setjmp and longjmp you can move from one function to another function. but it is very bad programming. since the ...

An lvalue was defined as an expression to which a value can be assigned. Is an array an expression to which we can assign a value? The answer to this question is no, because an array is composed of several 
Latest Answer : Array is not an lvalue..Eg.int arr[5] = {"1","2",.......};here arr[5] has  memory address and now we are assinging values to this.if we write arr[5]; in any function then it will not show any error, mean array does required lvalue ...

Declaring a variable means describing its type to the compiler but not allocating any space for it. Defining a variable means declaring it and also allocating space to hold the variable. You can also 
Latest Answer : int num;This statement is declaration and also defination since it also allocates memory for variable num.But when you use following statementextern int num;It is only declaration since you are not allocating memory here. ...

Streams can be classified into two types: text streams and binary streams. Text streams are interpreted, with a maximum length of 255 characters. With text streams, carriage return/line feed combinations 
Latest Answer : Will you please explain how binary mode takes less memory? ...

The preprocessor is used to modify your program according to the preprocessor directives in your source code. Preprocessor directives (such as #define) give the preprocessor specific instructions on how 
Latest Answer : Hi,   preprocessor is a program which processes our source program before it goes to the compiler for compilation. ...

A macro is a preprocessor directive that provides a mechanism for token replacement in your source code. Macros are created by using the #define statement.  Here is an example of a macro: Macros 
Latest Answer : Short name for long name/string/expersion is called macro. ...

The C preprocessor is used to modify your program according to the preprocessor directives in your source code. A preprocessor directive is a statement (such as #define) that gives the preprocessor specific 

The preprocessor will include whatever file you specify in your #include statement. Therefore, if you have the line  #include in your program, the file macros.inc will be included in 
Latest Answer : no ...

The answer depends on the situation you are writing code for. Macros have the distinct advantage of being more efficient (and faster) than functions, because their corresponding code is inserted directly 

When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor 
Latest Answer : if you used #include" filename.h" for including header files then the compiler will check only in the current directory.but if you used #include for including header files then the compiler will checks all directories specified ...


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

What is difference between call by value and call by reference in function?

The arguments passed to function can be of two types 1. Values passed 2. Address passed The first type refers to call by value and the second type refers to call by reference. For instance consider program1 main() { int x=50, y=70; interchange(x,y); printf(&ldquo;x=%d y=%d&rdquo;,x,
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school&rsquo;s al
 

The Interview Snafu

How to turn someone else&rsquo;s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won&rsquo;t get over the line without a polished, prof
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.&nbsp; By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.&nbsp; IT Certification offers several vari
 

Neuro-linguistic Programming Methods

Neuro linguistic Programming Methods There are several methods used for performing Neuro linguistic Programming on an individual for obtaining insights into the psyche of the person in order to correct to modify certain patterns of behavior These techniques are also used for Neuro linguistic trainin
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

The Difficult Past of Neuro-linguistic programming

The Difficult Past of Neuro linguistic programming Neuro linguistic programming has had a rocky past with a number of lawsuits rivalry unsystematic development and intermittent progress During the 1980s the two founders separated after the lawsuit filed by Bandler Bandler went on to file several law
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape