ADVERTISEMENT
ADVERTISEMENT

C - How to Use INTP as Integer Pointer using TypeDef in C Language.


IncludeHelp 12 August 2016

In this code snippet we will learn how to declare a typdef for integer pointer (int*)? if we don't want to use integer pointer (int*) every time in our program we want to customize it with a simple name. By using typedef we can make it simple like INTP (for integer pointer).

In this example we will declare INTP as Integer Pointer (int*) using typedef in c.

C Code Snippet - Integer Pointer as INTP using TypeDef in C

/*C – How to Use INTP as Integer Pointer using TypeDef 
in C Language.*/

#include <stdio.h>

//define typedef for integer pointer

typedef int* INTP;

int main(){
	//use INTP as integer pointer
	int normalVar;
	INTP number=&normalVar;
	
	printf("Enter an integer number: ");
	scanf("%d",number);
	
	printf("number (using pointer) is: %d\n",*number);
	printf("number (using normalVar) is: %d\n",normalVar);
	
	return 0;
}
    Enter an integer number: 362436
    number (using pointer) is: 362436
    number (using normalVar) is: 362436

ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.