Sunday, May 17, 2020

Example 3


Tip of the day!




Pre/Post increment

In pre-increment operand will be altered in value before it is utilized. In post-increment operand will be altered after it is utilized.
In the above snippet 
x = ++a is equivalent to
a = a +1 then
x = a
y = b++ is equivalent to
y = b
then b = b + 1

So the value of y = 10 and b = 11



Saturday, May 16, 2020

Some standard keywords in C

Tip of the day!

Note:

If two operands in an assignment expression are different data types, then the value of the expression on the right will automatically be converted to the type of the identifier on the left.

Example 2

#include<stdio.h>
int main()
{
    float f = 10.4;
    float g = 12.3;
    int result;
    result = (f < g) ? 1 : 0;
    printf("%d",&result);
}

what is the output of the above code?

Friday, May 15, 2020

Example 1

#include<stdio.h>
#include<ctype.h>
main()
{
    int lower,upper;
    lower = getchar();
    upper = toupper(lower);
    putchar(upper);
}

Questions:
1.) What is the difference between getchar() and putchar() ?
2.) Can getchar() have arguments? Justify the answer.
3.) What is the need for ctype.h header file?
 

Exploring float data type in C

Float is one among the basic data type in C.  Floating point numbers in C has precision up to 6 decimal places.  T he header file float.h de...