User Defined Datatypes – Typedef

It is a keyword, with the help of this we can put another name (alias)¬† to the existing data type. Syntax : typedef oldname newname; Example : typedef int rollnumber; //this a valid to compiler typedef int char; // this is not valid Here newname should not be a keyword means not known to the... Continue Reading →

Function Pointer

We can declare a pointer, that can point to each function. Syntax : returntype (*variable_name)(arguments ...); example: void (*p)(int,char); //here p ia an function pointer, which can point to a function that function should //take two arguments as interger and character and it will return nothing (void). How array name represents a base address in... Continue Reading →

Dynamic Memory Allocation

Definition : At runtime, we can able to decide storage capacity means we can decide the memory size whether we have to increment or decrement. There are two types memory allocations : Static memory allocation Dynamic memory allocation Functions used to allocate memory dynamically : Malloc Calloc realloc Syntax : void *calloc(size_t nmemb, size_t size)... Continue Reading →

Command Line Argument

There are three types of declaration we can write it: User-Friendly: int i; scanf("%d",i); //here compiler will waits for user input 2. OS-Friendly: int i = 7; //it directlly takes i = 7 as a input.it will not wait for user input 3. Local Time: Here command line arguments will come in picture. What is... Continue Reading →

2D Array / Array of Array / Matrix

Syntax : datatype variable_name[][]; //here first braces indicates Number of Rows // and second indicates Number of Column. In 2D Array, the elements are 1D Array. In 1D Array, the elements are integer or character. For example, int a[6] = int a[2][3]¬† this both are same in size and it is 24 bytes and we... Continue Reading →

Recursive Function

In one function definition, if you call the same function, those type of functions are called as a Recursive function. i.e. main() { main(); } i.e. void abc() { printf("Hello"); abc(); printf("Hello"); } Answer : Hello Hello --- (after certain time it will give segmantation fault because the memory will be full) Things to remember... Continue Reading →

Storage Classes in C

There are four main storage classes available in c programming: 1.Auto 2. Static 3.Extern 4.Register Used for variables and also used in the function. According to the storage class, compiler¬†behavior will be changed on that variable. Storage classes include some information like ... The default value of the variable, memory where it is stored, Scope(visibility)... Continue Reading →

Powered by WordPress.com.

Up ↑