Learn C Language from the Best Tutors
Search in
Asked by Ishwari Prashant sidwadkar Last Modified
The basic structure of a C program is :
Preprocessor directives to include libraries required for execution of the program
Declaration of global variables and macros
main() function{
code ;
}
other function definitions
read lessMahesh Kondawar
Mentor , Career Guide, Counsellor , and IT Trainer, NIELIT, HRD Ministry, Govt. of India
General form of c program is...
Global declarations
int main(parameter list)
{
statement sequence
}
return-type f1(parameter list)
{
statement sequence
}
return-type f2(parameter list)
{
statement sequence
}...
return-type fN(parameter list)
{
statement sequence
}
This form is mainly concerned with Functions and Declarations.
Significance of math.h file
math.h header files drives hundreds of maths functions along with one macro. This header file returns result as double and takes double as an argument.
Significance of string.h file
string.h header file drives string related functions . This header file defines any one variable type, one macro, and number of functions.
Basically header file contains Declarations, Definitions, and Macro of related number of functions which is defined in that particular header file.
Thanks
Regards
Mahesh v Kondawar
read less
Hello Ishwari
We know we have already defined data types like int, char, float, double.
Let's take int
When we declare
int i ;
It simply means an area of 2 Bytes(architecture dependent) gets allocated and the area is named as i and as our houses get some address in a street, in the same manner, this area will also have an address.
Now if we want some area which must contain say some 5 Bytes and that area has to be divided into 3 areas.
we want to give the first division to an int , the 2nd division to a char, the 3rd division to another int.
So this type of data type is not already defined.
So we need to make a data type like this on our own.
How to do that?
We use structure.
struct datatype
{
int i;
char c;
int j;
};
Now if we declare
datatype x;
Then x will have our desired memory allocation.
Math.h
has function definitions of the mathematical functions that we use.
example : pow()
Similarly, string.h has functions that we use t manipulate strings.
Documentation Section Link section Definition section Global Declaration Section |
Main() function section { Declaration part Executable part } |
Sub program section |
#include<stdio.h> //header file
main() // entry point for a program
{
// variables declaration
//logic which you want to achieve
}
math.h is a header file for working with mathmatical functions like abs() sum() etc..
string.h is also header file for working with string functions like strupr(),strlwr() etc..
without writing any manual code you can use these functions in your program for your purpose
ex: strlwr("nani") is automatically converted to "NANI" which is the output
read lessThe basic structure of a C program is :
Preprocessor directives to include libraries required for execution of the program
Declaration of global variables and macros
main() function{
code ;
}
other function definitions
1. math.h is a header file that is to be include in the program if functions like sqrt(), pow(), abs() sin() etc. are to be called.
2. string.h is a header file that includes various funcitons for working on strings. These include strlen(), strcmp(), strcat(), etc.
read lessHi Ishwari, I am glad to see students like you who are keen to learn to programme. As we all know that c is an excellent programming language which made a platform for various other software and operating systems. To make it such a secure language header file were made, which includes several functions. The header file like math.h is responsible for doing several mathematical calculations like power calc, sqrt calc and several trigonometrical calc and string.h is accountable for doing wonders like string copy, concatenation, changing upper case letters to lower case and vice versa with strings(a combination of characters).
The syntax for including math.h and string.h is:-
#include<math.h>
#include<string.h>
Thank you. I hope this will help you. Good luck.
View 35 more Answers
Related Questions
Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com
Ask a QuestionRecommended Articles
Lasya Infotech: An educational Training...
Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...
Read full article >
Brilliant Academy, a reputed B. Tech Tuition...
Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...
Read full article >
Why Should you Become an IT Consultant
Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...
Read full article >
8 Hottest IT Careers of 2014!
Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...
Read full article >
Looking for C Language Classes?
Learn from the Best Tutors on UrbanPro
Are you a Tutor or Training Institute?
Join UrbanPro Today to find students near youThe best tutors for C Language Classes are on UrbanPro
The best Tutors for C Language Classes are on UrbanPro