/*diff between define and typedef

Difference between typedef and #define:

->>>A macro is a piece of code in a program that is replaced by the value of the macro.
Macro is defined by #define directive. Whenever a macro name is encountered by
the compiler, it replaces the name with the definition of the macro. Macro
definitions need not be terminated by a semi-colon(;).

->>>The typedef is a keyword that is used in C programming to provide existing
data types with a new name. typedef keyword is used to redefine the name already
the existing name. When names of datatypes become difficult to use in programs,
typedef is used with user-defined datatypes, which behave similarly to defining
an alias for commands.

-> typedef is limited to giving symbolic names to types only, whereas #define 
can be used to define an alias for values as well, e.g., you can define 1 as ONE,
3.14 as PI, etc.

->typedef interpretation is performed by the compiler where #define statements 
are performed by preprocessor.

->#define should not be terminated with a semicolon, but typedef should be
terminated with semicolon.

->#define will just copy-paste the definition values at the point of use, while
typedef is the actual definition of a new type.

->typedef follows the scope rule which means if a new type is defined in a scope
(inside a function), then the new type name will only be visible till the scope 
is there. In case of #define, when preprocessor encounters #define, it replaces
all the occurrences, after that (No scope rule is followed).

*/

#include <stdio.h>

typedef int ada;

#define hii 6 //sud not use like this wrong

ada main(){
    ada a1;
    ada c;
    scanf("%d",&a1);
    c=a1+hii;
    printf("%d",c);
}

#if 0
#include <stdio.h>

#define MAX_LEN 6 //We use capital to diff between variables and define type

int main(){
    char a[MAX_LEN]="hello";/*we use define because in case we have many array
we use and its diff to change size everywhere without define and aslo it makes 
reader convinient to read and change so its imp*/
    printf("%s",a);
}
#endif

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: