edited by
304 views
1 votes
1 votes
difference between #define and typedef ???

please give logical answer not general answer
edited by

1 Answer

1 votes
1 votes
#define is a macro where preprocessor replaces all its presence with the value where typedef is a user defined data type

#define C 5

void main()

{

printf("%d",C);->here the  preprocessor replaces C with 5

}

typedef int x;

x a;

now x refers to integer datatype but name is user defined

Related questions

2 votes
2 votes
2 answers
3
srestha asked May 13, 2019
961 views
Can someone explain the output of this code? and what (char*) is doing actually?#include<stdio.h struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0',...
0 votes
0 votes
1 answer
4
Ashish Roy 1 asked Apr 11, 2019
603 views
X=2;Y=++x * ++x * ++x ;Printf("%d",Y);In the above question, we have to use the final value of x or it will be evaluated seperately and then multiplied.Ex: Y= 3*4*5; or Y...