Posts

strings in c programming

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); }

Arrays

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 

C Programming looping statements (part 2)

Next looping statements will continue here 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 befo...

C Programming loops

Welcome to c programming learning 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 w...

C programming statements

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 ...

Macros in c language

Welcome to c programming learning 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...

Header files in c

Welcome to c programming learning Last post program 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 defin...