Skip to main content

Posts

C Dynamic Memory Allocation

C Dynamic Memory Allocation In this tutorial, We will learn about dynamically allocate memory in your C program using standard library functions: malloc(), calloc(), free() and realloc(). Introduction In an array, we have to declare the size of an array before you use it. Hence, the array size we declared may be insufficient or more than required to hold data. To solve this issue, you can allocate memory dynamically. This technique allows us to obtain more memory when required and release it when not necessary. In C program, dynamic allocation achieve by 4 function which comes under <sdlib.h> library. malloc() : Allocates requested size of bytes and returns a pointer first byte of allocated space calloc():  Allocates space for array elements, initializes to zero and then returns a pointer to memory free():  deallocate the previously allocated space realloc():  Change the size of previously allocated space C malloc() ptr = (cast-type*) malloc(byte...

Bharat Heavy Electricals Limited (BHEL) Recruitment 2018

Bharat Heavy Electricals Limited (BHEL) Recruitment 2018 Company Name Bharat Heavy Electricals Limited Post Name Trade Apprentice State Tamil Nadu Salary Rs. 8,656-11,129 Number of Vacancy 529 Eligibility 10th with ITI    Last Date 13-09-2018 Application Details Job Notification Apply Online Job Application Government Jobs In Tamil Nadu  Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Uttarakhand Public Service Commission (UKPSC) Recruitment 2018

Uttarakhand Public Service Commission (UKPSC) Recruitment 2018 Company Name Uttarakhand Public Service Commission Post Name Lecturer State Uttarakhand Salary Rs. 9,300-34,800 Number of Vacancy 917 Eligibility Post-Graduation Degree  Last Date 25-09-2018 Application Details Job Notification Apply Online Job Application Government Jobs In  Uttarakhand   Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Naval Dockyard Mumbai (NDM) Recruitment 2018

Naval Dockyard Mumbai (NDM) Recruitment 2018 Company Name Naval Dockyard Mumbai (NDM) Post Name Apprentice State Maharashtra Salary - Number of Vacancy 318 Eligibility 10th with ITI  Last Date 21-09-2018 Application Details Job Notification Apply Online Job Application Government Jobs In Maharashtra  Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Pointer In C Programming Language

Pointer In C Programming Language In this post, We will learn about pointer in C programming language. Introduction Pointers in C programming language is a variable that stores the memory address of another variable. A pointer in C is used to allocate memory dynamically i.e. at runtime. The pointer variable might be belonging to any of the data types such as int, float, char, double, short etc. Important Points About Pointer in C: Pointer stores the address of a variable whereas a normal variable stores the value.   The content of the C pointer always be a whole number i.e. address. Default C pointer is initialized to null, i.e. int *p = null. The value of the null pointer is 0. & symbol is used to get the address of the variable. * symbol is used to get the value of the variable that the pointer is pointing to. If a pointer in C is assigned to NULL, it means it is pointing to nothing. Two pointers can be subtracted to know how many elements are available...

Assam Power Distribution Company Limited (APDCL)

Assam Power Distribution Company Limited (APDCL) Company Name Assam Power Distribution Company Limited Post Name Assistant Manager State Assam Salary Rs. 37,300-1,12,000 Number of Vacancy 167 Eligibility Graduation Degree Last Date 25-09-2018 Application Details Job Notification Apply Online Job Application Government Jobs In  Assam   Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Tripura Public Service Commission (TPSC)

Tripura Public Service Commission Company Name Tripura Public Service Commission Post Name Personal Assistant State Tripura Salary Rs. 5,700-24,000  Number of Vacancy 177 Eligibility 10+2 with minimum 45% marks Last Date 01-10-2018 Application Details Job Notification Apply Online Job Application Government Jobs In  Tripura   Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

String in C Programming Language

String in C Programming Language In this post, We will learn about string in C programming language. Introduction A string in C is merely an array of characters. The length of a string is determined by a terminating null character: '\0'. So, a string with the contents, say, "abc" has four characters: 'a', 'b', 'c', and the terminating null character. Initialize String in C Suppose you want to store Rozgardesh in String str you can do using one of below way 1. char str[] = "RozgarDesh"; 2. char str[50] = "RozgarDesh"; 3. char str[] = {'R','o','z','g','a','r','d','e','s','h','\0'}; 4. char str[11] = {'R','o','z','g','a','r','d','e','s','h','\0'}; Display String Here is an example to display the value of a string variable on th...

Comments in C Program

Comments in C Programming Language In this post, We will learn about comments in C programming language. We wirite comments in our to make it more readable on easily unstable.  A  comment never executed as part of the program means compiler ignore it. Type of Comment in C Single line Comment Multiline Comment Single line Comment Single line comments start with a double forward slash (//) // this is a single line comments compiler will ignore it Multiline Comment comments  In C programming multiline comments start with a forward slash and star (/*) and end with a star and forward slash(*/). /* this is a single line comments compiler will ignore it * Compiler will ignore it */ Example /* This is Hello world program * It will print Hello World on terminal */ #include <stdio.h> // including header file in program int main() // main function the program { printf("Hello World"); // printing Hello World on terminal return 0;...

Switch Statement in C Program

Switch Statement in C Program In this post, We will learn about switch case statement in the C programming language. The if..else..if ladder allows you to execute a block code among many alternatives. If you are checking on the value of a single variable in if...else...if, it is better to use a switch statement. Syntax Switch-Case in C switch (n) ​{ case constant1: // code to be executed if n is equal to constant1; break; case constant2: // code to be executed if n is equal to constant2; break; . . . default: // code to be executed if n doesn't match any constant } Example: Take a character input and find if the input is +, -, * or /.  # include <stdio.h> int main() { char operator; printf("Enter an operator (+, -, *, /): "); scanf("%c", &operator); switch(operator) { case '+': printf("+ Operator"); ...