Feb 20 2008

atoi,atol and atof functions

Welcome to my blog :-) .If you’re new here, you may want to subscribe to my full RSS feed. Thanks for visiting!These functions are available under stdlib.h .These are very unknown functions.Lets see what these do..
atol()
atol returns the value in terms of long datatype of the string containing numbers.the syntax is
atol(stringvariable)
ex: consider the following [...]

TAGS: , ,
Feb 20 2008

Saving the output in a text file

consider the following c program
#include<stdio.h>
#include<conio.h>
main()
{
int i,n;
clrscr();
printf(”Enter limit\n”);
scanf(”%d”,&n);
printf(”I will print %d times\n”,n);
for(i=0;i<n;i++)
printf(”I luv C\n”);
}
the output will be

Feb 20 2008

How C Compiler decides the Garbage values in case of data overflow

Garbage value in case of data overflow
I did some intense R&D for garbage values and found these facts.After understanding these concepts u can tell what will be the garbage value to be stored in a variable in case of dataoverflow.
Here are some of the basic facts required to proceed
In case of windows(TC),
The space allocated [...]

Feb 20 2008

Dynamic Output in C

Dynamic output
consider the following program
 
 
#include<stdio.h>
int main()
{
long double a=3.14159265;
printf(”Value of pi=%.4Lf”,a);
return(1);
}
the output of the program will be
 
Value of pi=3.1416
wouldn’t it be nice if we allow the user to choose how the precession of the answer would be??
that is the output should be like this
 
Enter precision
6
The value of pi precised to 6 decimal number is 3.141593
Well in [...]

Feb 20 2008

floor and ceil

 
floor and ceil
floor and ceil functions comes under math.h header file.
floor is used to round down the value of the decimal number and ceil is used to round up the value of the decimal number.
consider the following c program
#include<stdio.h>
#include<math.h>
#include<conio.h>
{
float a;
clrscr();
printf(”Enter any decimal number\n”);
scanf(”%f”,&a);
printf(”Using floor the value is %d and using ceil it is %d\n”,floor(a),ceil(a));
getch();
}
Output:
Enter any [...]

Page 2 of 3«123»