Posts

Showing posts with the label Basics of C-Language

Pointer | C Language | Start your journey with C | Part 8

Image
Pointer in C Language: Pointer which store address of variables . All variable have address whether it is int , char , float ,double 0 to 65535 address of memory block .  Integer in pointer : Character pointer in array: NOTE : Addresses in an array will change according to data type . For example :  Integer pointer pointer in array: Address will change by increment or decrement of 2 Float pointer in array: Address will change by increment or decrement of 4 & Operator : &(address) Operator is use for address of variable for output and input perpose . It is a unary operator also known as referencing operator . * Operator :   *(indirection) Operator is use to store address of variable. It is a unary operator also known as de-referencing operator . Basic syntax :  Sample 1 : Address , value in pointer. #include<stdio.h> void main() { int a=5,*p; p=&a; printf("%d\n",a); //value of variable printf("%d\n...

C Language | Function | Recursion | Start your journey with C | Part 7

Image
Function in C : Function is type of statement perform certain type of task in program , main() predefined function is the most important function in c program.  A Function can be predefined or user defined . All function predefined functions are declared in library file. A function can return only on value at a time with return function. A function have four(4) types of argument : These are user defined function. Function with no argument and no return value:                           Syntax :         void fun(void); #include<stdio.h> main() { ............. ............. fun(); } void fun(void) { ........... ........... } Sample : Add two number #include<stdio.h> void fun(void); //global void main() { printf("Enter two number to add :\n"); fun(); } void fun(void) { int c,x,y; scanf("%d%d",&x,&y); c=x+...

C Language | Operators | Start Your Journey with C | Part 3

Image
1.  Arithmetic operators : These are used to perform some arithmetic or mathematical operations on operands. The following table shows all the basic arithmetic or mathematical operators used in c programming : Operator                     Description      + adds two operands       - subtract second operands from first      * multiply two operand      / divide numerator by denominator      % remainder of division     ++ Increment operator - increases integer value by one Here is a basic C program to understand how this operators works : #include <stdio.h> int main() { int a = 5, b = 4, result; printf("a is %d and b is %d\n", a, b); result = a + b; // addition printf("a+b is %d\n", result); result = a - b; // subtraction printf("a-b is %d\n", res...

Start your Journey with C | Part 2

Image
3.Elements : Elements helps to create C Program. These are as follows : Alphabets : A to Z a to z Digits : 0 to 9 Special Characters : Character | Meaning______   + plus sign - minus sign * asterisk % percent sign \ Backward slash / forward slash < less than sign > greater than sign = equal to sign _ underscore ( left parenthesis ) right parenthesis { left braces } right braces [ left bracket ] right bracket , comma . period ' single quotes " double quotes : colon ; Semicolon ? Question mark ! Exclamation sign & ampersand | vertical bar @ ...