Pointer

Precedence and Associativity of the pointer and increment operators

Multiple choice question

What is the following statement do?

x = *ip++;

using a pointer received as parameter

Multiple choice question

What does the following code will print?

#include <stdio.h>
void my_func(int *x)
{
  x = (int *)malloc(sizeof(int));
  *x=12;
}
int main()
{
  int v=10;
  my_func(&v);
  printf("%d", v);
}

pointer initialization

Multiple choice question

I'm trying to declare a pointer and allocate some space for it, but it's not working. What's wrong with this code?

char* p1,p2;
*p2 = malloc(10);

Uninitialized int pointer

Multiple choice question

What will be the output of this C language program?

#include <stdio.h>
void inc_ptr(*int p){
  (*p)++;
  return;
}
int main(){
  int *p;
  *p=12;
  inc_ptr(p);
  printf("%d", *p);
  return 0;
}

C language Chapter 5

Questions:10
Attempts allowed:Unlimited
Available:Always
Pass rate:75 %
Backwards navigation:Allowed

This quiz contains questions to test knowledge suitable up to Chapter 5 at the "The ANSI C Programming Language" book by Brian W. and Dennis M.
Its include questions about C language pointers.

Start quiz
Syndicate content