Below some C++ statements are given. Which of the statements is wrong?
int var = 10;
int *ptr = &(var + 1); //statement 1
int *ptr2 = &var; //statement 2
&var = 40; //statement 3
If we execute the following 2 statements in C++, then what type of variables are p and q?
typedef char* CHAR;
CHAR p,q
What is the output of this C code?
#include <stdio.h>
int main()
{
char *p = NULL;
char *q = 0;
if (p)
printf(" p ");
else
printf("nullp");
if (q)
printf("q\n");
else
printf(" nullq\n");
}
What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 10;
void *p = &i;
printf("%d\n", (int)*p);
return 0;
}
Which statement is correct about the following declaration in C/C++?
int *ptr, p;
What is the output of this C code?
#include <stdio.h>
int main()
{
int *ptr, a = 10;
ptr = &a;
*ptr += 1;
printf("%d,%d\n", *ptr, a);
}
Which statement is correct about the following declaration in C/C++?
const int *ptr;
Which operator is indirection operator in C/C++?
In C/C++, which statement doesn’t assign null value into ptr if a=0?
What is the output of this C code?
#include <stdio.h>
int x = 0;
int main()
{
int *ptr = &x;
printf("%p\n", ptr);
x++;
printf("%p\n ", ptr);
}
What is the output of this C code?
#include <stdio.h>
int x = 0;
int main()
{
int *const ptr = &x;
printf("%p\n", ptr);
ptr++;
printf("%p\n ", ptr);
}
What is the output of this C code?
#include <stdio.h>
int main()
{
int x = 0;
int *ptr = &5;
printf("%p\n", ptr);
}