> Online tutorial : format statement in c
Showing posts with label format statement in c. Show all posts
Showing posts with label format statement in c. Show all posts

Expression in c

Expressions and values


The most common operators in any language are basic arithmetic operators. In C these are the following: function ()  /* provided it returns a sensible value */
+plus (unary)
- minus (force value to be negative)
+ addition
-subtraction
* multiplication
/floating point division
/ integer division "div"
% integer remainder "mod"

These operators would not be useful without a partner operator which could attach the values which they produce to variables. Perhaps the most important operator then is the assignment operator:
=   assignment operator

This has been used extensively up to now.
For example:
double x,y;

x = 2.356;
y = x;
x = x + 2 + 3/5; The assignment operator takes the value of whatever is on the right hand side of the = symbol and puts it into the variable on the left hand side.
As usual there is some standard jargon for this, which is useful to know because compilers tend to use this when handing out error messages.

format statement in c

Formatting statement in c


main() /* Main program starts here */
{
printf("Good form ");
printf ("can aid in ");
printf ("understanding a program.\n");
printf("And bad form ");
printf ("can make a program ");
printf ("unreadable.\n");
}

1.It is an example of a well formatted program. Even though it is very short and therefore does very little, it is very easy to see at a glance what it does.
2..Your C compiler ignores all extra spaces and all carriage returns giving you
3.considerable freedom concerning how you format your program. Indenting and adding spaces is entirely up to you and is a matter of personal taste.