how do I set the value of x to 2 and y to 3?


here is my code so far

#include <stdio.h>
int main(void)
{
	int x;
	int y;

	printf( "%d", x );


	return 0;
}

thanks for any help.

Recommended Answers

All 6 Replies

Welcome pyro_junky,
Ask your C-Language question in C forum.
Assignment operator = is used to set/assign a value to the variable.

x=2;
y=3;

oh sorry I thought I was using c++ lol. I'm really new at this :p

thanks for the help!

how do I set the value of x to 2 and y to 3?


here is my code so far

#include <stdio.h>
int main(void)
{
	int x=2;
	int y=3;

	printf( "%d", x );


	return 0;
}

this prgm has x=2 n y=3 n wil print value of x that is 2.

thanku

commented: you're welcome -6

code:

#include<stdio.h>

int main(void)
clrscr;

{
int x=2;
int y=3;

printf("%d"x);
printf("%d"y);

}


output:

x=2
y=3

commented: failcode -6

ADITI_89_SHARMA & nope3d,

Welcome to the daniweb.

Please read the following articles. These articles will help you to understand the rule at daniweb and also how to post?

1. Homework policy
2. How to post source code?
3. Title of thread must reflect your question.
4. Don't put any unnecessary comment to the thread.

@nope3d:

Test your code first before posting. This (very) simple program you wrote is full of syntax-errors.

Also use code-tags when posting code

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.