I'm trying to call two methods from main but I'm not sure how to do it.

I know the program isn't completed but I want to get this done first so I can test whether it's working correctly.

Could anyone help me out?

#include <stdio.h>
#include <stdlib.h>

void print_triangle_info(int area(), int perimeter());
void print_square_info(int area(), int perimeter());

static int a = 3;
static int b = 4;
static int c = 5;

int main(void) {

  // Tried many different combinations, but doesn't seem to work
  print_triangle_info(area, perimeter);
  print_square_info(area(), perimeter());
}

void print_triangle_info(int area(), int perimeter()) {
int x = 1/2 * b * c;
}

void print_square_info(int area(), int perimeter()) {

}

To begin with:
[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]To [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a cheater. 
    If you use that code [i]you[/i] are a cheater.
[*]Do [b]not[/b] bore us with how new you are. We can tell by your code.
- Do not apologize. We were all new, and unless you are completely 
  brain dead you will get better.
- Do not ask us to "take it easy on you."
- Do not say "I don't know what's going on." That's obvious since
  you posted for help. Use that time wisely by [b]explaining[/b] as best 
  you can so we can help.
[*][b]Do not post your requirements and nothing else. [/b]We view that as a lazy do-nothing student that wants us to do their work for them. That's cheating and we [i]will[/i] be hard on you.
[*][b]Do not tell us how urgent it is.[/b] Seriously, for us there is no urgency at all. Many that can help will ignore any URGENT or ASAP requests.
[/list]
Think more about your next post so we don't have to play 20 questions to get the info we need to help you.

[/boilerplate_help_info]


I'm trying to call two methods from main but I'm not sure how to do it.

Next, you're doing C. There are no methods. C has functions.

void print_triangle_info(int area(), int perimeter()) {
int x = 1/2 * b * c;
}

Where are area, perimeter, and x defined?
Why are you passing in area and perimeter and not using them?

void print_triangle_info(int area(), int perimeter());
void print_square_info(int area(), int perimeter());

Are 'area' and 'perimeter' functions? If not, why give parentheses after them.the correct form of prototyping will be:

void print_triangle_info(int, int);
void print_square_info(int,int);//takes two integers as arguments and return nothing(void)

and then their definitions

void print_triangle_info(int area, int perimeter) {//no parentheses after area and perimeter
//Now make use of the area and perimeter to print "triangle info"
}

and then call them from 'main'

int main(void) {
//calculate area and perimeter here or create functions to calculate them outside the 'main'

print_triangle_info(area, perimeter);
print_square_info(area, perimeter);
}

edit:
@ WaltP- Wow, that was quick!

Edited 5 Years Ago by D33wakar: n/a

Comments
Thank you for the heads up!
This question has already been answered. Start a new discussion instead.