does anyone know a program split a c source into many c files, where each c file contains a function of the initial c source?
example:
this file:
turn into these files:
thanks for the help!
example:
this file:
Code:
//file myprog.c ------------------
#include<stdio.h>
int a(int a, int b){
return a+b;
}
int b(int a, int b){
return a*b;
}
int main(){
printf("a(10,10)=%d\n",a(10,10));
printf("b(10,10)=%d\n",b(10,10));
}
//end of file myprog.c------------------------
Code:
//file a.h--------------------------------------------
int a(int a, int b);
//end of file a.h---------------------------------------
// file a.c -------------------------------------------
#include "a.h"
int a(int a, int b){
return a+b;
}
//end of file a.c--------------------------------------
//file b.h-----------------------------------------
int b(int a,int b);
//end of file b.h---------------------------------
//file b.c-------------------------------------------
#include "b.h"
int b(int a, int b){
return a*b;
}
//end of file b.c----------------------------------
//file main.c ------------------------------
#include <stdio.h>
#include "a.h"
#include "b.h"
int main(){
printf("a(10,10)=%d\n",a(10,10));
printf("b(10,10)=%d\n",b(10,10));
}
//end of file myprog.c ------------------------------
thanks for the help!
Comment