#define max 5
#define
int arr1[max]
main()
{
typedef
char arr2[max];
arr1
list={0,1,2,3,4};
arr2
name="name";
printf("%d
%s",list[0],name);
}
Answer:
Compiler
error (in the line arr1 list = {0,1,2,3,4})
Explanation:
arr2 is declared of
type array of size 5 of characters. So it can be used to declare the variable
name of the type arr2. But it is not the case of arr1. Hence an error.
Rule of Thumb:
#defines are used
for textual replacement whereas typedefs are used for declaring new types.
Blog Author: Vijay Kumar
Go to: Java Aptitude
No comments:
Post a Comment