lets look at the program you have modified and get rid of some obvious errors.
(1) you dont have a "compile error". the program you posted (the second one) compiles without any error even though it may have other flaws. what you have is a runtime condition ... if (argc != 3) ... that determined you didnt pass the required arguments, so it exited with an explanation why.
If i compile the program like so: gcc -o taiko taiko.c
then call it like so ./taiko
it will correctly exit with the warning that i did not provide the correct number of arguments.
so you must call it, for instance, like: ./takio <arg1> <arg2>
where and are values you (the user) provides that will be swapped, divded, etc.
(2) you have an "int swapargs( )" function embedded within the "void swapargs( )" function. i do not imagine this is correct. i assume you should only have a single function, "void swapargs( )"
part of the problem here is your complete lack of indentation, for blocks of code within the curly braces. maybe you had it at one point and lost it when you posted here. without indentation of code blocks, its very easy to make typos.
here is repost your code with the "void swaparg ( )" function fixed, and indentations and syntax coloring so we can at least see it better. you can use the code tags[code=c] and [/code] to frame your code, and indent your code with tabs or spaces (preferrably)
recompile the code and run it with the correct number of arguments in teh command line, and see if it works correctly. if it doesn't, at least you'll be able to track down why, in a more coherent manner.
#include <stdio.h>
#include <stdlib.h>
#define TERMINAL -9
/*Not sure if these are right*/
void swapArgs(int *a, int *b);
void divideArgs(int *a, int *b);
int *powerArgs(int *a, int *b);
/* MAIN */
int main(int argc, char **argv)
{
if (argc != 3)
{
printf("?Invalid number of arguments\n");
system("pause");
exit(1);
}
int parmA = atoi(argv[1]);
int parmB = atoi(argv[2]);
/* Part A: Swap the values. Value in parmA is moved to parmB and vice versa */
/* Reset the original values after we print the result */
printf("A=%d, B=%d. ",parmA,parmB);
swapArgs(&parmA,&parmB);
printf("Swapped values A=%d, B=%d.\n",parmA,parmB);
parmA = atoi(argv[1]);
parmB = atoi(argv[2]);
/* Part B: Divide parmA by parmB. Put the quotient in parmA, remainder in parmB */
/* Reset the original values after we print the result */
printf("Quotient of %d / %d is ",parmA,parmB);
divideArgs(&parmA, &parmB);
printf("%d, remainder is %d\n",parmA,parmB);
parmA = atoi(argv[1]);
parmB = atoi(argv[2]);
/* Part C: Raise parmA to the power of parmB. Return pointer to the result */
/* Reset the original values after we print the result */
printf("%d raised to the %d power is %.0lf\n",parmA,parmB,*powerArgs(&parmA, &parmB));
parmA = atoi(argv[1]);
parmB = atoi(argv[2]);
system("pause");
exit(0);
}
void swapArgs(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
/*I am not sure how to calculate the remainder*/
void divideArgs(int *a, int *b)
{
*a = *a / *b;
}
int *powerArgs(int *a, int *b)
{
*a = *a ^ *b;
return a;
}