#define DCHAR char*
typedef char* TCHAR;

if using these following variables will be declared like
DCHAR ch1, ch2;
TCHAR ch3, ch4;

then what will be types of ch1, ch2, ch3 and ch4?

Answers were Sorted based on User's Feedback



#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared lik..

Answer / shiva

ch1,ch3 and ch4 are char* types whiel ch2 is char type.
Please let me know if I am wrong.

Is This Answer Correct ?    22 Yes 5 No

#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared lik..

Answer / james holdcroft

Explanation:

DCHAR is a macro, which is expanded by the preprocessor.
TCHAR is a synonym for a pointer-to-char type.

After preprocessing, the code fragment expands to:

char* ch1, ch2;
TCHAR ch3, ch4;

which is perhaps more clearly written as:

char *ch1, ch2;
TCHAR ch3, ch4;

which is equivalent to:

char *ch1; char ch2;
char *ch3; char *ch4;

Is This Answer Correct ?    4 Yes 1 No

#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared lik..

Answer / sunil v r

char *

Is This Answer Correct ?    0 Yes 0 No

#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared lik..

Answer / guest

char *

Is This Answer Correct ?    0 Yes 0 No

#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared lik..

Answer / ashish

ch1 and ch2 are the char * and ch2 and ch4 are char type

Is This Answer Correct ?    0 Yes 0 No

#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared lik..

Answer / movemaker

^^All 4 will be char* types, why the hell would ch2 be char type like said above by Shiva . :P .

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More C Interview Questions

Write a code on reverse string and its complexity.

0 Answers   Expedia,


Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc

4 Answers  


Why do we use c for the speed of light?

0 Answers  


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

0 Answers  


There are 8 billiard balls, and one of them is slightly heavier, but the only way to tell was by putting it on a weighing scale against another. What's the fewest number of times you'd have to use the scale to find the heavier ball?

5 Answers   Microsoft, TCS,






What is the difference between Printf(..) and sprint(...) ?

0 Answers   InterGraph,


What are external variables in c?

0 Answers  


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

0 Answers  


write a program in c to print **** * * * * ****

1 Answers   TCS,


what will be the output of" printf("%d%d",scanf("%d% d",&a&b));"

4 Answers  


What will be the result of the following program? main() { char p[]="String"; int x=0; if(p=="String") { printf("Pass 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } else { printf("Fail 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } } a) Pass 1, Pass 2 b) Fail 1, Fail 2 c) Pass 1, Fail 2 d) Fail 1, Pass 2 e) syntax error during compilation

10 Answers   IBM,


What are the differences between Structures and Arrays?

0 Answers   TCS,


Categories