C Program to Swap Two Numbers using Pointers

Selection-sort-swapping

C Program to Swap Two Numbers using Pointers #include<stdio.h> int main() { printf(“\n\n\t\tEduguru – C Program Example\n\n\n”); int a, b; int *ptra, *ptrb; int temp; printf(“Enter value for a: “); scanf(“%d”, &a); printf(“\n\nEnter value for b: “); scanf(“%d”, &b); printf(“\n\nThe values before swapping are: a = %d b = %d”, a, b); ptra = &a; … Read more

Sorting program in c

c program to sort array

Sorting program in c /* * C program to accept N numbers and arrange them in an ascending order */ #include <stdio.h> void main() { int i, j, a, n, number[30]; printf(“Enter the value of N \n”); scanf(“%d”, &n); printf(“Enter the numbers \n”); for (i = 0; i < n; ++i) scanf(“%d”, &number[i]); for (i … Read more