Wrie C++ decleration for the following:
(i) Array of 10 integers
(ii) Pointer to character variable
(iii) Object of the class test
Answers
Answered by
21
Answer:
Explanation:
int a[10];
ch *a;
test obj;
obj.functionname;
Answered by
73
Answer:
Array of 10 integers:
1) int arr[10]; //Declaring an array with size directly and statically
2) int n;
cin>>n; // taking the size dynamically and let it be 10
int arr[n];
Pointer to character variable:
char* var="string to be placed"
as in,
char* a="hi hello"
cout<<a
output:
hi hello
Object of the class test:
Syntax:
class classname
{
//member vars and member functions
}
returntype main()
{
classname objectname;
//other statements
}
as per question,
the object creation of class test be:
In main function:
test testobj;
where testobj is the object of class test.
Similar questions