Yesterday, 14-August-2014 I didn’t even taste single word of code. I just focus on sleep, sleep and sleep. Don’t know why I slept all day (approx.). As I wasted my whole day so next day i.e 15-August-2014 I planned that I have to complete what I left behind no matter how.
Day being, wait wait, first of all Happy Independence Day. Today my target is to complete my C-lang concepts ASAP, as i’m running out to time to meet my deadline which I set for myself for FElt project. Don’t know how other understand any programming language so fast without leaning it’s concepts and all. I can’t do it like this, in my case firstly I revise all concept of language (basics ones) so that I can deal with them easily.

Today I learned great concepts of C-programming like memory allocation, typecasting etc. I want to share few with you.

  1. Dynamic Memory allocation :
    DMA is the process of allocating memory during program execution. That means at run time. Memory size can be modified while execution like linked list.In C language there are 4 type of memory allocation namely : malloc, calloc,  realloc and free.Here is the syntax of each memory allocation scheme.

    S.no
    Function
    Syntax
    1 malloc () malloc (number *sizeof(dataType));
    2 calloc () calloc (number, sizeof(dataType));
    3 realloc () realloc (pointerName, number * sizeof(dataType));
    4 free () free (pointerName);
  2. Type Casting functions :
    Typecasting concept in C language is used to modify a variable from one date type to another data type. New data type should be mentioned before the variable name or value in brackets which to be typecast.Under type casting I have learned few things till now like how to typecast string to float, string to int, string to long, int to string and long to string. I just go through all of them in brief not in detail. C language has pre-defined typecaste function for example if I want to typecaste from string to float, then there is pre-define function called atof(). For eg:

    #include <stdio.h>
    #include <stdlib.h>
    
    int main() {
        char a[20] = "3.14";
        float pi = atof(a);
        printf("Value of pi = %f\n", pi);
        return 0;
    }

    The output of this program will be 3.140000. In this char a[] is typecasting to float.

    It feels awesome while working on C, I got a feeling that FElt gonna be infinity time awesome. Objective-C rocks (y).  I almost done with my C concepts, from tomorrow onwards FElt i’m all yours :D.

Advertisements