Search Results

Showing results 1 to 15 of 15
Search took 0.00 seconds.
Search: Posts Made By: minas1 ; Forum: C and child forums
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
Nothing. Now show us the complete program. also use the typedef for the struct like I told you.
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
Yes.

In main, it's a better idea to actually create an oject
int main()
{
struct mytype mt = fundCalculation(....)
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
The function is correct, but you don't call it correctly.
Create 3 variables in main x, y, z, give them values and pass their address to the function.
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
#include<stdio.h>
struct mytype
{
int ok;
char ch;
};

struct mytype fundCalculation(int a,int b,int c)
{
struct mytype tmp;
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
Yes, but use our function that returns the struct.
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
Then instead of ints in the argument list, use pointers to ints.

a pointer to int: int *a = 0;

when you call the function, you need to pass addresses.

so

int x = 4;...
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
Well it works, good job!

Some tips:
Use this form when declaring a struct.

typedef struct
{
int ok;
char ch;
} mytype;
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
Ok, let's go step by step.
We will create a struct that has two members, a char and an int.
Go on and declare the struct.
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
Do you want the function to take pointers as parameters or return a pointer or both?
And why do you want to return 1?
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
So 1 has to be returned for you to know that the result is the third number. You can do it with only one return value:


char arithmeticOperation(int a, int b, int c)
{
// +
if(a + b == c)...
Forum: C Jan 10th, 2009
Replies: 26
Views: 1,232
Posted By minas1
You can't return two values from a functio using the return statement. Use a struct as you've been told to above:


typedef struct
{
int x, y;
} P;

P getPoint()
{
Forum: C Nov 27th, 2008
Replies: 13
Views: 1,851
Posted By minas1
#include <stdlib.h> /* needed for rand() function */
#include <time.h> /*needed to call srand() (explained below)*/

int main(void)
{
int r = 0;

/* by calling this function, we seed the...
Forum: C Nov 21st, 2008
Replies: 5
Views: 833
Posted By minas1
There are a couple of tutorials here (http://www.cprogramming.com/tutorial.html).
Forum: C Nov 8th, 2008
Replies: 14
Views: 1,042
Posted By minas1
You could use arrays as well.
Forum: C Nov 8th, 2008
Replies: 8
Views: 616
Posted By minas1
I think it's:

pow(number, power)

pow(10, 0.4);

I'm not sure so check it out. It's in <math.h>
Showing results 1 to 15 of 15

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC