I have no idea how to use multiple headers and source files in the big project. I can create one source file and header file in project. I want to understand how to create multiple headers and source files in the big project
I don't have any specific case in mind but I have written following codes and I would like to create multiple headers and source files
Program to sort array numbers in increasing order
Program Output
Program to Remove duplicates value with 0 in array
Note : If you don't like my use case for multiple header and source files, please suggest something suitable. @WBahn
I don't have any specific case in mind but I have written following codes and I would like to create multiple headers and source files
Program to sort array numbers in increasing order
C:
#include <stdio.h>
int main()
{
int i = 0;
int j = 0;
int temp;
int array[5] = { 50, 40, 30, 20, 10};
for ( i = 0; i < 5; i++)
{
for ( j = i + 1; j < 5; j++)
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
for ( i = 0; i < 5; i++)
{
printf(" %d ", array[i]);
}
return 0;
}
Code:
10 20 30 40 50
C:
#include<stdio.h>
int main()
{
int array[5] = { 1, 2, 1, 2, 5};
for ( int i = 0; i < 5; i ++)
{
for ( int j = i+1; j < 5; j++)
{
if ( array[i] == array[j])
{
array[j] =0;
}
}
}
for ( int i = 0; i < 5; i ++)
{
printf("%d ", array[i]);
}
return 0;
}
Code:
1 2 0 0 5
Last edited: