Create your own awesome maps

Even on the go

with our free apps for iPhone, iPad and Android

Get Started

Already have an account?
Log In

C Prog Language by Mind Map: C Prog Language
5.0 stars - 1 reviews range from 0 to 5

C Prog Language

Datatypes

A container or memory place to hold data-tems.

Built-In Type

Part of the language construct.

Integer, Signed, int, 16 bits, Ex:-32,768 to32,767, short int, 8 bits, Ex:-128 to127, long int, 32bits, Ex:-2,147,483,648 to 2,147,483,647, Unsigned, long int, 32bits, Ex:-2.147,483,648 to 2,147,483,647, short int, 8bits, Ex:-128 to 127, int, 16 bits, Ex:-32,768 to 32767

Float, long double, 80bits, Ex: 3.4E-4932 to 1.1E+4932, float, 32 bits

Character, Signed char, 8bits, Ex:-128 to127, Unsigned char, 8bits, Ex: 0 to255, Char

Double, double, 64bits, Ex: 1.7E-308 to 1.7 E+308

Derived Type

Derived from the existing datatypes.

Array

Funtions

Pointer

Reference

User Defined Types

Datatypes defined by the user.

Structure

Union

Enumeration

Design on Paper

Ms. Divya Khanure

mode

r - read only

w - write only

a - appending data

Strings

Collection of characters.

Concatenation

strcat(str1,str2); output is str1str2

Comparison

strcmp(str,str2); ASCII str1 - ASCII str2, +ve if str1<str2, -ve if str1 > str2

Copying

strcpy(str1,str2); outputs str1="str2";

Length

n=strlen(str);

Substr and many more string functions are available...

Built in function in ctype.h

isalpha(x)

isdigit(x)

isalphanum(x)

ispunct(x)

islower(x)

C- Tokens

Special Symbols (Delimeters)

;,!?#$

Constants & Variables

Numeric Constants, int, %d, decimal, Ex: -129, 78 etc, octal, Ex: 037, 5011 etc, hexadecimal, Ex: 0X2, 0XA3 etc, real, float, %f, Ex: -2.73, 0.71 etc, exponential, 12e-2, -1.2E-1

Character Constants, Single, %c, '5', ASCII Values => pf("%d",'a'); printf("%c",97);, 'S', String, %s, "Hello", "!..?..34#", Backslash, '\b', '\0', null, '\t', tab, '\n', new line, '\"', inverted comma

Keywords

Basic Building Blocks, int, if, case, while, struct, auto, break, case, do, for, else, continue, goto, return, switch, union, void, float, char, long, int, short, double, sizeof, typedef, register, static, const, extern, define

Identifiers

May be varible or a function name or array varibale.

Ex: amount, sum etc

Strings

Ex" :SDMCET", "123"

Operators

Operators operate on operands.

Arithmetic, +, -, /, %, *

Logical, ||, &&, !

Assignment, +=, -=, *=, /=, %=

Conditional, exp1 ? exp2 : exp3;

Special, sizeof, , [comma]

Increment / Decrement, post, ++, pre, --

Bitwise, &, /, <<, >>, ~

Relational, <, <=, >, >=, ==, !=

Expressions

Expression may be constant or a variable or a combination of these connected by operators.

Arithmetic

precedence, high, *, /, %, low, +, -

example, a*b-c ->a*b-c, 3*x*x-x ->3x^2-x

Conversions

automatic type, follows the hierarchy of size of the operands

casting a value, (type name)exp;

Mathematical Functions

#include<math.h> cc filename -lm, example, exp(x), fabs(x), sqrt(x)

Input/Output

Read and Write statements.

Formatted

Input, scanf("control string", &arg1,&arg2..);

Output, printf("control string", arg1,arg2..);

Unformatted

putchar, putchar(variable_name);

getchar

Control Statements

Used to control the flow of execution.

if

simple if, if(test exp){ body;} statement -x;

if else, if(test exp){ true-block}; else {false-block}; statement-x

nested if else, if(test exp1) { if(test exp2){ statement1} else {statement2;} else {statement 3}; statement-x;

else if ladder, if(condition1) statement1; else if(condition2) statement2; else if.........else if(condition n) statement n; else default statement

swicth

switch(exp){ case value1:block1; break; case value2:block2; break; ..........default:block; break; } statement-x;

conditional

conditional exp? exp1:true exp2:false

goto

Loops

Used to repeat the task (set of statements)

continue (skip)

for

for(initialize ; test exp ; increment) { body; }

while

while(test exp) { body; }

do.. while

do { body ; } while(test exp);

break (jump)

Arrays

Set of similar data items. Ex: Set of integers.

Dimensions

One, Declaration, type var_name[size];, Initialization, type name[size]={list of values};

Two, Declaration, type name[row_size] [col_size];, Initialization, type name[row_size] [col_size]={{row list},{col list}};

Multi, Declaration, type name[s1][s2][s3]....[sn];, Initialization, type name[s1][s2][s3]...[s3]={{list s1},{list s2}, {list s3}, {list s4}.....{list sn}};

Character Array (String)

Declaring / Initialising, char name[size];

Reading, scanf("%s",name);

Writing, printf("%s",name);

Functions

A set of instructions to do a particular task.

declaration

type name (type var1.......)

calling

main() { name(var1........); }

Call By Value - actual value of parameters

Call By Reference - pointers

types

with no arguments no return type

with no arguments one return type

with arguments no return type

with arguments multiple return type

definition

syntax, type name(type var1........) { local declaration; executable part; return(var); }

Recursion

Function calling itself

Pointers

Pointer is a varibale holding an address of another variable.House Number (addr) : Pointers Members in a house: Values House Name : Identifier

declaring

datatype *pt_name

initialize

p=&quantity

accessing

int quantity *p,n quantity=179; p=&quantity; n=*p

Files

Collection of related records.

Open

FILE *fp; fp=fopen("filename","mode");

Close

fclose(file_pointer);

Input

putc(c, fp1);

c=getc(fp2);

Access

position, n=ftell(fp);

reset position, rewind(fp);

moving, fseek(fp,offset,position)

Output

fprintf(fp,"control string",list);

fscanf(fp,"control string",list);

Structures / Unions

Structure is nothing but a record.It is a user defined datatype or collection of dissimilar data-items.

define a structure

struct name; { data type member1; datatype member2;..........};

initialization members

main(){ struct name{ datatype mem1; datatype mem2;.....}; struct name mem1={constant.....}; struct name mem2={constant......}; }

struct name{ datatype mem1; datatype mem2;.....};mem1={constants.......}; main(){ struct name mem2={constants.....};...............}

History of C

ALGOL

BCPL

B

Traditional C

ANSI C

ANSI/ ISO C

Dennis Retchie

Few Other Links

Companies using C Programming Language

https://docs.google.com/spreadsheet/ccc?key=0AvPic5Th8MOmdFdHc05mRHQwQmFNazk0T0N1RDRmcUE&usp=sharing#gid=0

NPTEL Videos

http://nptel.ac.in/courses/106104074/

http://ekalavya.it.iitb.ac.in/eVideos/CS101/content/preview.html

NPTEL Slides

Virtal Lab

Spoken Tutorials