Skip to main content


Welcome to Daily Updates

*** Happy Learning***

==>Bigg Boss 6 Telugu

==> JAVASCRIPT QUIZ

==>AADHAAR download, Date of birth,name and Address correction, PVC card and more links

==> MICROSOFT EXCEL TUTORIAL

C programming 2021

 C programming 2021

C programming Introduction


 It is really very easy to learn so move forward.....

C programming is a basic programming language, which is procedure oriented language that means this c language is all works on functions only like main function and other predefined or user-defined functions.





    C programming mainly consists of pre processor and functions, some data types as well as variables.
 Example---- :
Program is as follows,,,,


  #include<stdio.h>
  void main()
{
   int a=2;
   printf("%d",a);
}

 Output :2

     In that pre processor we use *include* this is command , which works the including to program. And also mainthing is header files , the header files consists of pre defined functions like printf ,scanf,pow,strrev..... Examples of header files are stdio.h, math.h,stdlib.h..........
   Examples-------:
   1. #include<stdio.h>
   2.#include<stdlib.h>
  3.#include<math.h>

In that function, we can write main function in that we use parameters or else we can leave that empty that is no parameters function. And also we can use return type integers or float or void. Void means we can't return anything. Default return type of any function is integer only.  If we declare as integer then we can return 0 or any value.
  Examples-----
    1. int main(a,b)
  Here a,b are parameters
 Int is return type of function
main is name of function
2.int main()
In this no parameters given, then there is no problem in that.


Data types in C programming Language

After the function in c programming we have to use curly braces. In that braces we can write statement what ever we want to do.  And next , we have to mind one thing that is  every statement must ends with semicolon (;).

    Example------
          int i;
 Here it is data type and this whole thing is statement

In that printf and scanf are the input and output function, which are returning integer values only, these two are predefined functions.



And also main part to learn in c programming is data types that is  as follows....
1.int
2.float
3.double
4.char


1.int:--
    int is one the data type in c programming those are indication of integer values only.
In that int we have signed integer and unsigned integer. These two integer data type difference making at ranges. In unsigned we don't have negative ranges that means starts from zero. In this long int and short two types are there in the integers.

Examples------ int i;
            int i=5;
2. Float: -----
These is used for the float values which are having pricision of 6 digits.

 Example----
 1.float t;
2.float t=5.0000;
3.float  r=5.6;

3.double:---
This is another one for float values but the difference is how many digits after point or decimal values. In this precision value is 15 digits
Example------
    A.double a;
   B.double b=6.89999926762;



4.char::::
Char is used to represent a character and in c programming language we don't have string data type that's why we use char array as string. In this signed and unsigned char is there for address only. This is starts  from -128 to  +127. This is 1 byte address data type.




In this way we have data types , which are predefined data types. We have some user defined data types , those are structures, union.



Variables in C programming language 

After the data types main thing is to know the variables. That are not to be predefined keywords like return,if .... etc.
  Rules to be a variable is-----
 1.It may contain letters, numbers, underscore (_).
2.  It must not contain any other sign marks like ;,:,-,+.
3.variable is not to be a keyword.

Example:
 int a;
Here int is data type, a is variable.

int _3a;
This is valid one.
int 3_a;
This is also valid

Identifier:
Identifier is also like as variable.
int a; this identifier. Identifier must contain data type followed by variable.
Example:

 int a;


And then next topic is operators.....
Connect next post to learn operators...
.
Thank you 😊


A small task for you all.... That is please comment output of the below program

 #include<studio.h>
 void main()
{
  int a=054;
  printf("%d",a);
}

   What is output of this code..........?

Variables in C programming language 

Last post program output is -
4*8^0+5*8^1=44
Because it is octal number by placing 0 in front of number.
 I hope you clear. If there is any doubt please comment...

Next topic of c programming is operators
 Those are classified as follows
1. Arithmetic operators
2. Logical operators
3. Relational operators
4. Assignment operators
5. Bit wise operators
6.  Increment operators
7. Decrement operators

1. Arithmetic operators:-
   These are mainly used for doing arithmetic operations. That is addition, subtraction, multiplication , Division.
Signs are +,-,/,*

Ex:-  a+b;
  a-b;
 a*b;
a/b; // it returns divisible value
 Note:
   a%b; // it returns remainder

2. Logical operators:-
 These are used for logical operations like AND,OR,NOT,XOR...etc.
Signs are &&,||,!, .. etc

Ex:-a&&b
  In this condition both non zero then only true otherwise false

 a||b
 In this condition one of two is non zero or true then true otherwise false
 !a
In this , if a is 0 then it makes 1, If a is 1 then 0

3. Relational operators:-
 These are used for making comparisons in that condition. Signs are < ,>,<= ,>=
 Ex:-
a>b;
a<b;
a<2;
a<=3;..
etc


4. Assignment operators:-
 These are used for assign some values to the variables in c programming.
Sign is =.
Ex:- a=2;
   a+=2;

5. Bit wise operators:-
These are used to make the operation in bit wise. In this the give number is divided into it's binary format then operation will done.
Signs are &,|,^ etc

Ex:-
a&b;
a|b;

6. Increment operators:-
 This is one of the operator commonly use in programming. When we want to increase one value each time.sign is ++; That is as follows
Ex:-
a++;
 This means a=a+1;


7. Decrement operators:-
If we want to decrement in each step by one only then this operator is apt for that. This sign is --. Double subtraction sign.
This is as follows example

Ex:-
a--;
This equal to a=a-1;


This is over all operators. Thank you for reading..
Next post will be on keywords...



Here I am giving one program please solve and comment the output below....
  #include<studio.h>
  int main()
{
  printf("%c",~("b"*-1));
 return 0;
}

Output :.  ?????????

In downside I will give you output...........


 output is :- a

C Programming keywords - points:



1. Keywords in c are predefined words in c
2. All keywords are in lower case only. Because c language is case sensitive.
3. These keywords can't be used as variables
4. Keywords in c also called as reserved words
5. In c we have 32 keywords.

List of 32 keywords in c:-


1.int
2.float
3.double
4.long
5.short
6.extern
7.register
8.static
9.auto
10.if
11.else
12.switch
13.for
14.struct
15.union
16.do
17.case
18.default
19.while
20.break
21.return
22.signed
23.unsigned
24.typedef
25.char
26.const
27.continue
28.goto
29.void
30.sizeof
31.volatile
32.enum

These are the keywords of c language.

Below I am giving one program please comment output below..

#include<studio.h>
void main()
{
  int a=2;
  printf("%d",a++);
}



 Output give you in downside.



output is 2


Now we are going to learn about header files.

HEADER FILES


Header files are very important in c programming language because these header files consists of predefined functions like printf(),scanf(),pow()....etc
There we have more header files in that we learn here some which are some what important...


1.stdio.h


In this header file consists of address of Function that is printf() and scanf() functions addresses.
This means standard input and output.

2.conio.h



Next of above header file we use this.
In this we have two main functions definition those are clrscr(), getch(),getche()

3.stdlib.h



 This is standard library header file. In this we have dynamic memory allocation functions definition ,those are malloc, calloc, realloc, free. And also delay(),rand(),abs(),exit() functions definition are there in this library.

4.math.h



This header file consists of all mathematical functions definition, those are floor(),round(),ceil(),sin(),cos(), cosh(), sinh(), pow()....etc.

Note:- In this floor (3.5)= 3
 ceil of 3.5 is 4

5.time.h


In this we use related  to time that is setdate(),getdate(),clock(),time() ...etc

6.signal.h


In this we use signal(),raise()..etc

7.errno.h


In this errno() function definition is there.

8.ctype.h


It consists of isgraph() function definition.
And also ispunct(),isdigit(),isalpha().

9.unistd.h


It consists of sleep() function definition. This function is used to make some delay in the execution.

10. string.h


This is exclusive  for strings ( array of characters) that is strcpy(),strrev(),strcmp(),strcat(),strlwr(),strupr(),..etc.

Like we have limits.h for string...etc



Today's programs ...

Please comment output of this programs...


1.#include<studio.h> void main() {  int a= 2; printf("%d",++a);
} Output :-


2.#include<studio.h>

#include<math.h> void main() {  int a= ceil(4.5); printf("%d",a); } Output:-...

 outputs :
1. 3
2. 5

Macros in C Programming Language 

Last post programs outputs
1. 3
2. 5

Now we are going to learn about macros in c programming

MACROS

Macros are very useful. These are beginning of the program or above the main() function.
Let , #define is used to indicate macros 
Macros are as follows...

1. Define something with their alias names then we use #define

Examples------ #define printf pf
Here we can use pf in the place of printf 


2. Header files

#include<stdio.h>
In this we # that means pre processor. In this pre processor is execute first.

3. Conditional


In this we use condition loops that is if ,else 
With beginning of  #.
That is #if, #else

4. If there is defined something previously that can be remove defined that is by using #undefined

Examples------
 #defined d 15
#undefined d 15
 To make undefined of d value


Give the output below in comment section


#include<studio.h>
#define n 15
void main()
{
   printf("%d",n);
}


Output:-

Statements in C Programming Language

Commonly statement is a line of code in c programming but statement also some types

1.simple statement:

     Simple statements don't have any condition and also they ends with semicolon (;). Like printf and scanf statements

Example--
  1. printf("c programming learning");
  2. scanf("%d",&a);
 
The above two can we called as simple statements. 

2. Conditional or control statement:

  These are having condition in the line. It may contain some block of code, if the condition is true then only inside block will execute otherwise won't execute.
  That's why for these statement we don't put semicolon at the end of the statement

 Examples-----

 1.if(a<2)
   {
      Printf ("SSCprogramming");
  }
   If and only if the a value must be less than 2 then only this will execute otherwise not execute.
 That's why we have to care about condition, what we are using in the code.
This will execute only single time. That's why this is not looping.

2. If(condition)//conditional statement
     Simple statements
   else
     Simple statements
  The above code is for execution of code in both the cases,  if the if condition is false then else part will execute.
 3.while(condition)
 In this the condition is true it continuesly execute untill we get false over there
That's why this is looping.



3. Complex statements:


 In this we can use both simple as well as condition or control statements, that's why we call it as complex statements.

Examples-----
if(printf("SS"))
  i++;

In this if consist of printf statement as well as condition.
NOTE: we all know that printf returns integer values , those are how many letters of numbers printing by printf statement
......



That's all about statements .

Loops in C Programming Language 

Looping statement are most popular for writing any because if we want to make iteration in a program must we need looping statements that's why looping statements are playing key role in the coding. 


Now let's move on to looping statements

Looping statements are 
1. For loop
2.while loop
3.do-while loop
These three we use for iterations in coding....


1. For loop


  For loop consist of three simple statements in the for loop two brackets.
Syntax:
for(assignment statement; conditional or control statement; increment or decrement statement)
  In the above is syntax for the looping statement of for.
 In this one statement that is increment is not there then also it execute. If we using conditional statement must be assignment is done.

If the three statements are not present in the for loop the loop will iterate infinite times. But there must be place the semicolon (;) three times.

If we place semicolon at the end of for loop it won't iterate, it makes only one time execution like if loop

Example---
 for(i=0;i<5;i++)
i=0; is assignment 
i<5; is condition or control (after false condition it is controlled)
i++; increment statement


for(; ; ;)
this is loop which gives infinite iteration.

for(; ; ;);
This is only one time execution statement.
Because we place semicolon like as simple statement

2.while: 
While is one of the important looping statement
 In while, we assign at somewhere ,condition we place in while and increment or decrement at last. While and for is same but the difference is syntax functionality is same.

By using while code length is increasing.

Syntax: 
     Assignment;
While (condition)
  //Simple statements;
Increment or decrement operation;

While loop is simple like for loop but writing code is somewhat difficulty in means of writing three statements in a code.

Example----
 i=0;
while(i<5)
printf ("SSCprogramming");
i++;

In the above code assignment is happened initially. After that while checks the condition then it moves on next statements inside the while loop 
Then increment happen.

Output is 5 times prints SSCprogramming

3. Do-while
  This is reverse of while in case of checking condition.
 In this intialisation or assignment will be at some place before the condition checking. 
After that do the some statements. And then checks the condition..

Syntax: 
Assignment
Do 
 Simple statements
While (condition)

In this assignment is for assign. And then do the what operations in the do loop and then checks the condition.

Example----

i=0;
do{
 printf("SSCprogramming");
}while (i<5)
i++;

Explanation:
i=0; is for assignment
do is for do the next statement
While for condition checking and making iteration
i++; for increment...

Output will be 6 times SSCprogramming



Note: while print zero times if the condition is false at intially, In case of
Do-while will print one time if the condition is false also.
That means while check the condition first
But in case of  do-while checks the condition after performing the operation of executing the statement

Basic Info About Arrays in C Programming Language 

Arrays are playing very important role in c programming. Those are widely using in many applications of programming.
Array defined as it is a collection of similar data type elements.

data types we discussed previously...

Array is having two major parts taht is size and index
Index is point where the particular data is occur.
Size is total number of elements.

But the most important thing is array start from zero index...

Types of arrays are....
1. Single index array - common array
2. Double index array - matrix array
3. Multi index array

The above all divide  by  the index parameter 

Strings in C Programming Language 


coming to strings in c programming....

string is a character of array. that in this we can represent characters.

for example char s[20] means that we can write a word of character up to 19 characters.

strings data also starts from zero index on wards but the difference is to find some operations we have predefined functions like strlen(), strcpy()...etc

string can be consist of special characters.

in fact in c programming there is no such data type to indicate strings directly...


for example one program to find length of the string ....

#include<stdio.h>
void main()
{
char s[10];
scanf("%c",&s);
int n=0;
n=strlen(s);
printf("%d",n);
}


More information about C Programming Language will be added soon.






















Comments

Popular posts from this blog

JNTUK R16, R19 CGPA TO PERCENTAGE CALCULATOR

JNTUK R16 PERCENTAGE CALCULATION Here R16 batch students can calculate percentage according to obtained CGPA throughout the graduation. JNTUK introduced SGPA, CGPA in 2020 batch that is R16 REGULATION. Most of the companies ask percentage but students suffer how much percentage equal to obtained CGPA. for that here providing a wonderful platform for calculation of percentage by providing CGPA. Andhra Pradesh SI and Constable recruitment Notification 2022 Details - Click here ENETR CGPA BELOW BOX AND GET PERCENTAGE: ENTER CGPA    Percentage   For Lateral Entry students CGPA Calculator-  click here for Regular students CGPA Calculator -   click here Andhra Pradesh SI and Constable recruitment Notification 2022 Details - Cli

JNTUK R16 SGPA and CGPA calculator for Lateral entry b.tech

Lateral entry students those are joined directly engineering by completing polytechnic, they may or may not appeared for ECET for getting seat in engineering course. that is B.Tech students studied course in 4 years but lateral entry students studied course is 3 years, that one year spend in polytechnic course. Lateral entry students strong in Technically than regular students. for SGPA calculator -   click here NOTE: IF ANYONE WANT CALCULATE UPTO SOME SEMISTERS(LIKE UPTO 3-2) FOR PLACEMENTS CAN PROVIDE REMAINING SGPAS AND TOTAL CREDITS AS ZEROS(0) THEN WILL GET ACCURATE CGPA TILL THAT PARTICULAR SEMISTER. FOR LATERAL ENTRY SCHEME B.TECH CGPA IS... FIRST SEMISTER SGPA    total credits   SECOND SEMISTER SGPA    total credits   THIRD SEMISTER SGPA    total credits   FOURTH SEMISTER SGPA    total credits   FIFTH SEMISTER SGPA    total credits   SIXTH SEMISTER SGPA    to

JNTUK R16 SGPA and CGPA Calculation

JNTUK university is affliating many colleges of eastern part of the Andhra Pradesh. JNTUK introduced SGPA AND CGPA concept by declaring result with grade secured and grade points, also credits. total credits for R16 is 180. Grade points for grades. SGPA has to calculate every semister but CGPA is caluculated over all semisters Grade - Grade points 1. O - 10 2. S - 9 3. A - 8 4. B - 7 5. C - 6 6. D - 5 7. F - FAIL For SGPA calculation for every semister - click here NOTE: IF ANYONE WANT CALCULATE UPTO SOME SEMISTERS(LIKE UPTO 3-2) FOR PLACEMENTS CAN PROVIDE REMAINING SGPAS AND TOTAL CREDITS AS ZEROS(0) THEN WILL GET ACCURATE CGPA TILL THAT PARTICULAR SEMISTER. FOR CGPA ENTER DETAILS BELOW : FIRST SEMISTER SGPA    total credits   SECOND SEMISTER SGPA    total credits   THIRD SEMISTER SGPA    total credits   FOURTH SEMISTER SGPA    total credits   FIFTH SEMISTER SGPA    total credits