# Introduction to c  (Page 4/4)

 Page 4 / 4

C expressions are arranged in the following groups based on the operators they contain and how you use them:

• Arithmetic expression
• Conditional expression
• Assignment expression
• Comma expression
• lvalue
• Constant expression

Expressions are used as

• Right hands of assignment statements
• Actual parameters of functions
• Conditions of if statements
• Indexes of while statements
• Operands of other expressions . . . .

## Functions

A subprogram (also known as a procedure or subroutine) is nothing more than a collection of instructions forming a program unit written independently of the main program yet associated with it through a transfer/return process. Control is passed to the subprogram at the time its services are required, and then control is returned to the main program after the subprogram has finished.

The syntax used to represent the request of subprogram varies among the different language. The techniques used to describe a subprogram also varies from language to language. Many systems allow such program units to be written in languages other than that of the main program.

In most procedural programming languages, a subprogram is implemented as though it were completely separate entity with its own data and algorithm so that an item of data in either the main program or the subprogram is not automatically accessible from within the other. With this arrangement, any transfer of data between the two program parts must be specified by the programmer. This is usually done by listing the items called parameters to be transferred in the same syntactic structure used to request the subprogram’s execution.

The names used for the parameters within the subprogram can be thought of as merely standing in for the actual data values that are supplied when the subprogram is requested. As a result, you often hear them called formal parameters, whereas the data values supplied from the main program are refereed to actual parameters.

C only accept one kind of subprogram, function. A function is a sub program in which input values are transferred through a parameter list. However, information is returned from a function to the main program in the form of the “value of the function”. That is the value returned by a function is associated with the name of the function in a manner similar to the association between a value and a variable name. The difference is that the value associated with a function name is computed (according to the function’s definition) each time it is required, whereas when a variable ‘s value is required, it is merely retrieve from memory.

C also provide a rich collection of built-in functions.There are more than twenty functions declared in<math.h>. Here are some of the more frequently used.

 Name Description Math Symbols Example sqrt(x) square root $\sqrt{x}$ sqrt(16.0) is 4.0 pow(x,y) compute a value taken to an exponent, xy ${x}^{y}$ pow(2,3) is 8 exp(x) exponential function, computes ex ${e}^{y}$ exp(1.0) is 2.718282 log(x) natural logarithm ln x log(2.718282) is 1.0 log10(x) base-10 logarithm log x log10(100) is 2 sin(x) sine sin x sin(0.0) is 0.0 cos(x) cosine cos x cos(0.0) is 1.0 tan(x) tangent tg x tan(0.0) is 0.0 ceil(x) smallest integer not less than parameter $⌈x⌉$ ceil(2.5) is 3; ceil(-2.5) is –2 floor(x) largest integer not greater than parameter $⌊x⌋$ floor(2.5) is 2; floor(-2.5) is –3

Library

The library is not part of the C language proper, but an environment that support C will provide the function declarations and type and macro definitions of this library.The functions, types and macro of the library are declared in headers.

C header files have extensions .h. Header files should not contain any source code. They are used purely to store function prototypes, common #define constants, and any other information you wish to export from the C file that the header file belongs to.

A header can be accessed by

#include<header>

Here are some headers of Turbo C library

stdio.h Provides functions for performing input and output.

stdlib.h Defines several general operation functions and macros.

conio.h Declares several useful library functions for performing "console input and output" from a program.

math.h Defines several mathematic functions.

string.h Provides many functions useful for manipulating strings (character arrays).

io.h Defines the file handle and low-level input and output functions

graphics.h Includes graphics functions

## Statements

A statement specifies one or more action to be perform during the execution of a program.

C requires a semicolon at the end of every statement.

Comments are marked by symbol “/*” and “*/”. C also use // to mark the start of a comment and the end of a line to indicate the end of a comment.

1. The Hello program written using the first commenting style of C /* A simple program to demonstrateC style comments The following line is essentialin the C version of the hello HUT program */#include<stdio.h>main() {printf /* just print */ ("Hello HUT\n"); }The Hello program written using the second commenting style of C // A simple program to demonstrate// C style comments //// The following line is essential // in the C version of the hello HUT program#include<stdio.h>main() {printf("Hello HUT\n"); //print the string and then go to a new line }

By the first way, a program may have a multi-line comments and comments in the middle of a line of code.However, you shouldn’t mix the two style in the same program.

## C program structure

A C program basically has the following form:

• Preprocessor Commands : Declare standard libraries used inside the program
• Type definitions : Define new data types used inside the program
• Function prototypes : Declare function types and variables passed to function.
• Variables : State the names and data types of global variables
• Functions: Include the main function(required) and the functions that their prototypes were announced above.

how can chip be made from sand
is this allso about nanoscale material
Almas
are nano particles real
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Got questions? Join the online conversation and get instant answers!