Home » Aptitude Questions and Answers » C Aptitude Questions and Answers

C Typedef - Aptitude Questions and Answers



C programming Typedef Aptitude Questions and Answers: In this section you will find C Aptitude Questions and Answers on typedef topics, defining/changing name of any data type, using and accessing the typedef values.

1) What will be the output of following program ?
#include < stdio.h >
int main()
{
	typedef int AAA,BBB,CCC,DDD;
	AAA aaa=10;
	BBB bbb=20;
	CCC ccc=30;
	DDD ddd=40;
	printf("%d,%d,%d,%d",aaa,bbb,ccc,ddd);
	return 0;
}
  1. Error
  2. 10,10,10,10
  3. 10,20,30,40
  4. AAA,BBB,CCC,DDD

2) What will be the output of following program?
#include < stdio.h >
int main()
{
	typedef auto int AI;
	AI var=100;
	printf("var=%d",var);
	return 0;
}
  1. var=100
  2. var=AI
  3. var=0
  4. Error



3) What will be the output of following program?
#include < stdio.h >
int main()
{
	typedef char* string;
	string myName="ABCDEFG";
	printf("myName=%s (size=%d)",myName,sizeof(myName));
	return 0;
}
  1. myName=ABCDEFG (size=7)
  2. Error
  3. myName=ABCDEFG (size=4)
  4. myName=ABCDEFG (size=8)

4) What will be the output of following program?
#include < stdio.h >
int main()
{
	typedef struct 
	{
		int	 empid;
		int  bsal;
	}EMP;
	EMP E={10012,15100};
	printf("%d,%d",E.empid,E.bsal);
	return 0;
}
  1. 10012,15100
  2. 0,0
  3. ERROR
  4. 10012,10012






Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.




Comments and Discussions





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 (2015-2018), Some rights reserved.




close Like other websites, this site uses cookies to deliver relevant ads based on your interest, by using our website, you acknowledge that you have read our privacy policy.