can any help me i have to do my assignment that how to swap 5 number using pointer in c++...

What do you have so far? Do you know what a pointer is? We only help people that show effort. If you dont show your code you dont get code.

yes i now pointer check this code but this swap only two numbers i have to do input 5 numbers...

#include <stdio.h>

int main()
{
   int x, y, *a, *b, temp;

   printf("Enter the value of x and y\n");
   scanf("%d%d", &x, &y);

   printf("Before Swapping\nx = %d\ny = %d\n", x, y);

   a = &x;
   b = &y;

   temp = *b;
   *b = *a;
   *a = temp;

   printf("After Swapping\nx = %d\ny = %d\n", x, y);

   return 0;
}

how can you swap 5 numbers? What are the exact reqiurements for the assignment?

if you can swipe two numbers than you can swipe as many as you want with a loop, you just need to figure out how many swipes you need to make and which values/variables will be swipe each time

how can you swap 5 numbers?

yes , that is the point. how do you swap these numbers ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.