0% found this document useful (0 votes)
4 views

Every Function

The document contains a C program with various functions for sorting arrays of strings and integers, generating Fibonacci sequences, merging arrays, and manipulating strings. Key functions include sorting in ascending and descending order, printing arrays, and converting strings to title case. The main function is defined but does not execute any operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Every Function

The document contains a C program with various functions for sorting arrays of strings and integers, generating Fibonacci sequences, merging arrays, and manipulating strings. Key functions include sorting in ascending and descending order, printing arrays, and converting strings to title case. The main function is defined but does not execute any operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

#include <stdio.

h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <ctype.h>

void sortArray(char names[][1000], int n)

char temp[1000];

int i,j;

for(i=0;i<n-1; i++)

for(j=0;j<n-i-1;j++)

if(strcmp(names[j],names[j+1])>0)

strcpy(temp, names[j]);

strcpy(names[j], names[j+1]);

strcpy(names[j+1], temp);

void sortchar(char a[], int n)


{

char temp;

int i,j;

for(i=0;i<3;i++)

for(j=0;j<3-i;j++)

if(a[j]>a[j+1])

temp=a[j];

a[j]=a[j+1];

a[j+1]=temp;

void fibonaci(int n)

int a=0,b=1,i, temp;

printf("1 ");

for(i=1;i<=n;i++)

{
int sum = a+b;

a=b;

temp=sum;

b=temp;

printf("%d ", sum);

void tronmang(int a[], int b[], int c[], int n, int m, int k)

int i;

k = m + n;

for (i=0; i<n; i++) {

c[i] = a[i];

for (i=0; i<m; i++) {

c[i+n] = b[i];

void swap(int* xp, int* yp)

int temp = *xp;


*xp = *yp;

*yp = temp;

void SortMinMax(int a[], int n)

int i, j, min_idx;

for (i = 0; i < n - 1; i++)

min_idx = i;

for (j = i + 1; j < n; j++)

if (a[j] < a[min_idx])

min_idx = j;

swap(&a[min_idx], &a[i]);

void SortMaxMin(int a[], int n)

int i, j, max_idx;

for (i = 0; i < n - 1; i++)

max_idx = i;

for (j = i + 1; j < n; j++)


if (a[j] > a[max_idx])

max_idx = j;

swap(&a[max_idx], &a[i]);

void printArray(int a[], int size)

int i;

for (i = 0; i < size; i++)

printf("%d ", a[i]);

printf("\n");

void printString(char c[], int n)

int i;

for (i = 0; i < n; i++)

printf("%c ", c[i]);

printf("\n");
}

void printArrays(int a[], int size)

int i;

for (i = 0; i < size; i++)

printf("%d ", a[i]);

printf("\n");

void Upper(char c[], int n)

int i,j;

for(i=0;i<n;i++)

if(i==0&&isspace(c[i])==0)

c[i]=toupper(c[i]);

for(j=1;isspace(c[j])==0;j++)

c[j]=tolower(c[j]);

}
else if(isspace(c[i]))

c[i+1]=toupper(c[i+1]);

for(j=i+2;isspace(c[j])==0;j++)

c[j]=tolower(c[j]);

int main()

return 0;

You might also like