#include<stdio.h>
void main(void)
void change(void);
int x=4,y;
y=x;
{
printf("\n The value of x is = %f and the value of y is = %d",x,y);
change();
printf("\n The value of x is = %d and the value of y is = %d ",x,y);
}
void change(void)
{ 
x=x+3;
}

and i need this programs plz .. can u help me

(a) Write a C program that uses two user defined functions, one of the functions calculates the sum and the other calculates the product of two numbers.
(b) Write a C program that uses pointers to calculate the sum of the elements of an array.
(c) Write a C program that declares and initializes two variables and then write their values on a file.

1. The x variable doesn't exist in the change function. The function should accept an int reference if you want to change it in the func, then pass x in.

void change(int &x);
int main()
{
   int x = 4,y;
   ...
   change(x);
   ...
   return 0;
}
void change(int &x)
{
   x = x + 4;
}

2. YOU write C programs to do all that stuff, come back with actual questions and we'll do what we can to help.

Also, for future reference, post the errors you're getting with your code. The more you do to tell us what your issue is, the more likely we are to help you. Oh, and "plz" isn't a word.

Sorry but I do not speak English, but I'm trying to translate my words into English
Thank you for helping me

It's cool. It always just seems that non-native english speakers get almost every other word right except 'please'.

Best of luck and welcome to DaniWeb =)

I wrote two programs, but I'm in dire need of the third and be honest with you I could not at all to write the third program

#include<stdio.h>
int sum (int a, int b);
int mult (int c, int d);
void main ()
{
int x,y, z=0, k=0;
printf("enter tow number\n");
scanf("%d%d", &x,&y);
z= sum(x,y);
printf("the summation is: %d",z);
k= mult(x,y);
printf("\n the multiplication is: %d",k );
}
int sum (int a, int b)
{
return (a+b);
}
int mult (int c, int d)
{
return (c*d);
}

program number 2

#include<stdio.h>
void main ()
{
int sum=0,b[3]={1,4,6};
for (int i=0; i<3; i++)
sum = sum+ *(b+i);
printf ("%d", sum);
}

I wrote two programs, but I'm in dire need of the third and be honest with you I could not at all to write the third program

1) Learn to format your code so it can be read and followed easily
2) See this
3) We won't write it for you. Most of us don't need the grade.

thank WaltP .. i have one more question

i need steps of using files for input and output and also how i make use of pointers for passing arguments to functions?

For C-style file i/o, look into FILE *s and how to use them.

For using pointers with functions, write the function so it accepts a pointer and pass a pointer one of a few ways:

void stuff(int *x)
{
   *x = 4;
}
int main()
{
   int x;
   int *y;

   stuff(&x);
   stuff(y);
}
commented: I like your answer better. +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.