954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

check out this code

greetings folks,


#include
#define T t
void main()
{
char T = 'T';
printf("\n%c\t%c\n",T,t);
}

just check what is the output of this program
and puhleease tell me reason whyit happens so??
:rolleyes:

akki_freak
Newbie Poster
12 posts since Nov 2005
Reputation Points: 10
Solved Threads: 0
 

greetings folks,

#include #define T t void main() { char T = 'T'; printf("\n%c\t%c\n",T,t); } just check what is the output of this program and puhleease tell me reason whyit happens so?? :rolleyes:

compile and run that program, then you will see for yourself what the output is. Why does it happen? Because T and t are both the same thing. The #define statement at the top of the program tells the compiler that T is just another name for t.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You