Hello Guys let's Start C language
*****************************
Practical ==
C_Program
Note -- Pyramid program is below Right side
Array / Square / Triangle / Sum / Prime / Matrix
Max_Mini / LeapYear / Add_Sub / Licence /
String / Structure / Typecast / Armstrong
Areatriangle / Switch_pro / Fectorial / Fibonanc_series
Formula_1_to_6 / Go_to_pro / Area
**********************************
Theory --
What is C
C is a computer programming language
Note -- C programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system.
Structure of C
Documentation Section
Link Section
Definition Section
Main () function Section
{
Declaration part
Executable part
}
subprogram section
function 1
function 2
-
-
-
-
function n
-----------------------------------------------------------------------------------------------
Type Storage size
char 1 byte
unsigned
char 1 byte
signed char 1 byte
int 2 or 4 bytes
unsigned int 2 or 4 bytes
unsigned
short 2 bytes
long 4 bytes
unsigned
long 4 bytes
------------------------------------------------------------------------------------------------
So let's Start Easy Program
1)
#include <stdio.h>
int main()
{
/* my first program in C */
printf("Hello, World! \n");
return 0;
}
--------------------------------------------------------------------------------------------
Operators
5 types Operators
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Assignment Operators
-------------------------------------------------------------------------------------
- Arithmetic Operators --
Operator Example
+ A + B
- A - B
* A * B
/ B / A
% B % A
++ A++
- Relational Operators --
Operator Example
== (A == B)
!= . (A != B)
> (A > B)
< (A < B)
>= (A >= B)
<= (A <= B)
-----------------------------------------------
- Logical Operators --
Operator Example
&& (X&& Y)
|| (X || Y)
! !(X && Y)
---------------------------------
- Assignment Operators --
Operator Example
= Z = X + Y will assign
the value of X + Y to Z
+= Z += X is equivalent
to Z = Z + X
-= . Z -= A is equivalent
to Z = Z - X
*= Z *= X is equivalent
to Z = Z * X
/= Z /= X is equivalent
to Z = Z / X
%= Z %= X is equivalent
to Z = Z % X
<<= Z <<= 2 is same as Z
= Z << 2
>>= Z >>= 2 is same as Z
= Z >> 2
-----------------------------------------------
Loops Types
1 for
2 while
3 do while
4 nested
Syntax --
For --
for ( init; condition; increment )
{
statement(s);
}
Syntax
While --
while(condition)
{
statement(s);
}
Syntax --
Do While --
do
{
statement(s);
}while( condition );
Syntax --
Nested --
for ( init; condition; increment )
{
for ( init; condition; increment )
{
statement(s);
}
statement(s);
}
=============================
go to statement --
goto label;
..
label: statement;
-----------------------------------------------------------------------------------------
1] Call by Value --
The Call by Value method of passing arguments to a function copies the actual Value of an argument into the formal parameter of the function.
2] Call by reference --
The Call by reference method of passing arguments to a function copies the address of an argument into the formal parameter.
===========================
What is Array
Arrays is kind of data structure that can store a fixed-size sequential collection of
elements of the same type.
What is Pointer
A Pointer is a variable which contains the address in memory of another variable. We can have a Pointer to any variable type.
*************************************************************
Good for startup... Keep it up
ReplyDeletethanks raj kumar like and support.
Delete