> October 2011 ~ Online tutorial

nested if else statement in c

Nested if else statement syntax If(test condition1) { If(test condition2); { Statement1; } Else { Statement2 } Else { Statement 3 } Statement –x If the test expression can be executed first if it is true then true block can be executed immediately following if statement are executed otherwise false statement are executed if neither case...

arguments with no return type

Function with argument and no return type: #include #include void print(); void line(int x,int y); void main() { int a,b; clrscr(); print(); printf("Enter thevalues"); scanf("%d%d",&a,&b); line(a,b); print(); getch(); } void print() { int a; for(a=0;a<=10;a++) printf("-"); } void line(int a,int b) { int c; c=a+b; printf("%d",c); ...

function types in c

No argument and no return type: #include #include void printline(); void main() { int a; clrscr(); printline(); printf("\nthis is world\n"); printline(); getch(); } void printline() { int i; for(i=1;i<=40;i++) printf("-"); } getch(...

Declaration of function in c

Declaration of function: 1.function name 2.function type 3.list of parameter syntax Function type function_type(parameter list) Example int mul(int m,int n)...

function definition in c

Element of user defined function: 1.function definition 2.function call 3.function declaration Defintion of function A function definition ,also known as function implememtation shall include the following elements 1.function name 2.function type 3.list of parameter 4.local variable declaration 5.function statement 6.a return type Syntax Function...

recursive function in c

A multi fuction program A function is a self contained block of code that perform a particular task.once a function has been designed and packed .it can treated as a black box that takes some data from main program and return the values Program:b #include Void printline(); Main() { printline(); printf(“this world”); printline(); { Void printline() { int...

function in c

user defined function Need for user defined function: As pointed out that main is a specially recongized fuction in c.ever y fuction program must have main function to indicate where the functionhas to execution has to begin its execution. ...

copying structures in c

#include<stdio.h> #include<conio.h> struct detail { char name[10]; int page; }; void main() { int x; struct detail m1={"anbu",10}; struct detail m2={"kan",20}; x=((m1.name==m2.name)&&(m1.page==m2.page))?1:0; if(x==1) { printf("correct"); } else { printf("bad"); } getch(); } Output:bad...

initializing structure variables in c

initializing structure variables in c Like any other datatype ,a structure variable can be initializes at compil time Syntax: main() { struct { datatype variable; datatype variable1; } student ={60,70,90}; } This assigns values 60 to student.variabel and 70,90 to student.variable2 . there is a one to one correspondence between the member and...

declaring structure variables

Declaring structure variable after defining a structure format we can declare vraiable of data type. A structure variabel declaration is similar to the of variable of any other data type.it includes the following elements 1.the keyword struct 2.the structure tag name 3.List of names separated of commas For example ,the statement struct book_bank,book1,book2,book3 declares...

stucture in c

unlike arrays ,structure must be defined first for their format that may be used later to declare structure variable. syntax struct book_bank { char title[20]; char author[10]; int pages; }; Explanation the keyword struct keyword declares a structure to hold the details of three data fields,namely title,author,pages. these fields are...