#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

Explain how can you be sure that a program follows the ansi c standard?

0 Answers  


what is c

4 Answers  


What is the use of define in c?

0 Answers  


what is develop in c language

2 Answers  


Magic square

0 Answers  


whitch value return void main?

11 Answers  


Print all the palindrome numbers.If a number is not palindrome make it one by attaching the reverse to it. eg:123 output:123321 (or) 12321

7 Answers   HCL,


What is difference between arrays and pointers?

0 Answers  


Is it better to use a macro or a function?

0 Answers  


program to find the ASCII value of a number

8 Answers  


What is malloc() function?

0 Answers  


what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf("%d",*c); ++q; } for(j=0;j<5;j++) { printf("%d",*p); ++p; } }

4 Answers  


Categories