Write a c program to swap two numbers.
C Programming Language Pointer in C Language (Article) Pointer in C Language (Program)
1113
Here we used concept of function.
Here we used concept of pointer.
Here we used temp pointer variable.
Program:
#include void swap(int *a, int *b) { int temp; temp = *a; *a = *b; *b = temp; } int main() { int x=5,y=10; void swap(int *,int *); printf("%d %d\n",x,y); swap(&x, &y); printf("%d %d\n",x,y); return 0; }
Output:
5 10 10 5
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.