logo codesdope
Level 1
1.
What would be the output of:
#include <stdio.h>
int main(){
    int i = 10;
    printf("%u",&i); 
    return 0;
}
2.
What would be the output of:
#include <stdio.h>
int main(){
    int i = 10;
    printf("%d",*(&i)); 
    return 0;
}
3.
What is a pointer to a pointer?
4.
Write a function which returns a pointer.
Level 2
1.
Write a program to print the address of a variable whose value is input from user.
Answer
#include <stdio.h>
int main()
{
  int x;
  printf("Enter a number.\n");
  scanf("%d",&x);
  printf("Address is %u\n",&x);
  return 0;
}
									

2.
Write a program to print the address of the pointer to a variable whose value is input from user.

3.
Write a program to print the value of the address of the pointer to a variable whose value is input from user.
Answer
#include <stdio.h>
int main()
{
  int x,*y;
  printf("Enter a number.\n");
  scanf("%d",&x);
  y = &x;
  printf("Value of the address of pointer of %d is %u\n",x,&y);
  return 0;
}
									

4.
Write a program to print a number which is entered from keyboard using pointer.
Answer
#include <stdio.h>
int main()
{
  int x;
  printf("Enter a number.\n");
  scanf("%d",&x);
  printf("Value is %d\n",*(&x));
  return 0;
}
									

5.
Write a program which will take pointer and display the number on screen. Take number from user and print it on screen using that function.
Answer
#include <stdio.h>
void print(int *a)
{
  printf("Value is %d\n",*a);
}

int main()
{
  int x;
  printf("Enter a number.\n");
  scanf("%d",&x);
  print(&x);
  return 0;
}
									

6.
Write a program to find out the greatest and the smallest among three numbers using pointers.

Level 3
1.
Write a program to find the factorial of a number using pointers.

2.
Write a program to reverse the digits a number using pointers.
Doubt? Ask question
Close

Welcome.please sign up.

Close

Welcome.please login.