Posts

See a problem in else if statement

Dangling else problem

Image
Hello, This problem comes when we use else if statement and do some mistake more describe is given below......... Dangling else problem: One of the major problem with nested if is dangling else problem. The problem arises when both outer if statement inner if statement might pair with common else statement. Thus the compiler is not able to judge to pair the else with which statement. The solution to this problem is given by the compiler that it pairs else with the recent if thus sometimes giving wrong result.                                           Hence the programmer should put early bracket wherever required. This post is may very short because my only aim was to describe this problem. Thank you, Keep supporting............. 

Call by value and call by reference

hello friends here i will tell you what is call by value and call by reference, This is a topic of function,This topic will be used in c programming too much. Call by value: We had been calling function and passing arguments to them using call by value method.In the call by value method ,the called function creates new variables to store  the value of the argument passed to it.Therefore the called function uses a copy of the actual argument to perform its intended task.  If the called function is supposed to modify the value of the parameters passed to it,then the change will be reflected only in the called function.In the calling function no change will be made to the value of the variables.This is because all the changes were made to the copy of the variable and not to the actual variables.   to understand this concept the code given below.The add( ) function accepts an integer variable num and adds 10 to it.In the calling function ,the value of  nu...

What is Array in C|| Array

Hello friends today we are going to start new topic of c language name is ARRAY Today, in this post i will tell describe you that what is array and where we use this? So now start this topic and friends please ask your doubts in comment if you have any kind of problem. Array: Array is a collection of similer type of  elements stored in continuous memory allocation. Mean we can store only same type value in array after declare that. If we declare that or integer we can only store integer number in it,if we declare for float we can store any float number. But we know float can store any integer value but int can't store any float value so after declare for int we will store only integer value. If we store any digit in array it store continuously in memory so we can easily find address of any array element. When we declare any variable it store any where in memory but when we use array for declare many variable it allocate continuously in memory. Type of array: The...

Different Types of Codes

Hello guys, you are learning C language Here you many times hear name ASCII code and other codes now today in my this post you will learn about all codes. firstly i tell you that i will tell about 4 codes..................... BCD Code:  ( Binary coded decimal ) Here each digit of decimal no. is represented by it binary equivalent.Four bit code that represents one of the ten decimal digits from 0 to 9. Ex. (37)base 10 is represented as 0011 0111 using BCD code, rather than (100101) base 2 in straight binary code.Thus BCD code requires more bits than straight binary code.Still it is suitable for input and input operations in digital systems. EBCDIC: (Extended binary coded decimal for interchange code) In this code it is possible to represented 256 different characters.It is an eight bit code.8-bit alphanumeric code developed by IBM, supports 256 symbols.It was mainly used in IBM mainframe computers.                   ...

Storage Class Part 2

This is a second part of storage class............................. Extern: Keyword used is extern. Identifiers declares in global scope by default has extern storage class. If the extern variable is declared in local scope then it cannot be initialized with declaration but if it is declared with global scope than it can be initialized with declaration. The extern storage class specifiers is used to  specify that an object is defined with external linkage. Extern variable can not be used in parameter. Ex. #include<stdio.h> int a=20; main() { print("Value of a:%d",a); } Output: Value of a:20 Typedef: typedef is used for syntactic convenience. Used for creating a synonyms or alias for a known type. Does not introduce a new type. Syntax: typedef datatype   variable name   new name; Ex. #include<stdio.h> main() { typedef int pi; pi x=5,y=10; printf("x=%d\n",x); printf("y=%d\n",y); retur...

Storage Class in C Part 1

Hello guys today in this post we will discus about storage class. Storage class: Every identifiers not only has data type but also has a storage class the storage class the storage class of an identifiers determine the following character-  scope of an identifiers Storage of an identifiers Storage location of an identifiers  Lifetime of an identifiers Linkage of an identifiers Initial value of an identifiers The storage class of an identifiers can be specified will the help of storage class specified  following are storage class specifiers- auto static typedef register extern It most one storage  class specifier can be specified in a declaration statement. Auto: Keyword used in auto. By default an identifiers declared with in a block has auto storage class. The auto identifiers is stored in main memory. The lifetime of automatic storage class is local i.e. the identifiers will come into existence from the point if its dec...

Recursion

Image
Today we are going to discus about recursion topic in function.Simple words me ager aapko bata du iska use kerek hum kaafi bade programm ko short ker dete hai inka mean recursion ke progrma ki length normal function ke progream se kam hoti hai. Isme only thora sa thinking process hota hai . jisse hum ek statement aisa creat kerte hai jo ba rbar khub ko call kerta hai aur end me aapko result de deta hai. Recursion: Recursion is a powerful programming technique that can be used to solve the problem of smaller size.A function can call itself and the function is called as an recursion function. Recursion is classified according to following criteria - Whether function itself directly or indirectly. Whether there are any pending operation form the recursion call. Patter of recursion call. There are two type of recursion- Direct recursion Indirect recursion Direct recursion: A function is directly recursive if it call itself directly. That is a function body c...

Rule of function declaration and type of variable

Image
Hello guys , today in this my post i will tell you some basic rule of  function declaration and how many types of variable we use in function . Rule of function variable: Find declaration needs to be ended using semicolon. Return type is optional. Type of  parameter & number of parameter are combings called parameter list. The parameter C in the list may or may not have parameter name. No parameter can have some names even parameter name and function name cannot be same. A function need not be declared if it is defined before it is called. Ex. Void add ( int , int ) The above declaration declare a function name and with two parameter of type of int and return type of void ( function does not return ).  Function header is same as function declare but without a semicolon,It consist of return type , function name , parameter type and no. of parameter. Variable: There are two types of variable in function- Local variable Global variable ...