Шукаєте відповіді та рішення тестів для Course 31709? Перегляньте нашу велику колекцію перевірених відповідей для Course 31709 в lms.aub.edu.lb.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
How to release the memory allocated by a pointer in C++?
What does the following C++ code do?
#include<iostream>
using namespace std;
int main() {
int *ptr = NULL;
ptr = new int;
*ptr = 7;
cout << *ptr;
delete ptr;
return 0;
}
How do you dynamically allocate memory for an array in C++ using pointers?
What is the correct way to dynamically create an object in C++?
typedef struct Student
{
int rollno;
int total;
} Student;
Student s1;
struct Student s2;
Which statement is correct?
Consider the following three C functions:
[PI] int * g (void)
{
int x= 10;
return (&x);
}
[P2] int * g (void)
{
int * px;
*px= 10;
return px;
}
[P3] int *g (void)
{
int *px;
px = (int *) malloc (sizeof(int));
*px= 10;
return px;
}
Which of the above functions are likely to cause problems with pointers?
Consider the following program. Where are i, j and *k stored in memory?
int i;
int main()
{
int j;
int *k = (int *) malloc (sizeof(int));
}
int main() {
char p[]="geeksquiz";
char t;
int i,j;
for(i=0,j=strlen(p);i!=j;i++,j--)
{
t=p[i];
p[i]=p[j-i];
p[j-i]=t;
}
printf("%s",p);
return 0;
}
Output?
The most appropriate matching for the following pairs (GATE CS 2000)
What is returned by malloc() if the allocation fail?