C-Pointers Question and Answer

C-Pointers Question and Answer
211. Which of the following statement agree weith the statement "It declares a function that recives a pointer to a pointer to a char and returns a pointer to a pointer to a pointer to a char"
  • char *MyFun (char **);
  • char **Myfun (char **);
  • char ***Myfun(char**);
  • None of these
Show Answer
212. What is the true about the code
static char vo1atile const *Myfun( )
{
static char vo1atile const *p="Madhu";
return p;
}
void main ( )
{
printf("%s",MyFun( ) );
}

  • The code is perfect and output is Madhu
  • Error too many storage class
  • No error but p is a dangling pointer
  • Error leading to memory curruption.
Show Answer
213. Find the output
void main ( )
{
const int i=5;
const int *p;
int *q;
p=&i;
q=&i;
(*q)++;
printf("\n %d, %d\n", *p, *q);
}

  • 6, 5
  • 5, 6
  • 6, 6
  • Compilation error
Show Answer
214. Find the output
void main ( )
{
int a[ ] [3] = {a, 2, 3, 4, 5, 6};
int (*ptr)[3]=a;
printf ("%d %d",(*ptr) [1], (*ptr)[2]);
++ptr;
printf("%d %d",(*ptr)[1], (*ptr) [2]);
}
  • 2 3 5 6
  • 2 3 4 5
  • 4 5 0 0
  • None of the above
Show Answer
215. Which format specifier is used to find out the offset address of a variable ?
  • %o
  • %p
  • %h
Show Answer
216. Find the output
void main ( )
{
int *p=(int*) f( );
*p=9;
printf("%d", *p);
}
f()
{
int *p=malloc(2*sizeof(int));
return p;
}

  • 9
  • 4
  • compilation error
  • None of these
Show Answer
217. Find the output
void main ()
{
char huge *p=(char huge*) 0x02220110;
char huge *q=(char huge*)0x00002330;
if (p==q)
printf("equal and Normalized");
else
printf("Not Equal and NOrmalized");
}

  • Nor equal and normalized
  • Equal and normalized
  • Memory scratch
  • Huge pointers can't be compared
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test