Saturday, March 28, 2020

What is C Data Type structure

C Data Type

In this you will learn basic data types such as int, float, char etc in C programming.
In C programming, data types are declaration of variables. This determines the type and size of data association with variables. 
For example :
Here, myVar, is a variable of int (integer) type.The size of int is 4 bytes.

Basic Data_types

Here's a table of containing commonly used types inn C programming for quick access.



Int

Integer are whole numbers that can have both zero, positive and negative but no decimal values.
For example :
we can use int for declaration an integers variables .
int a;

Here,  a is a variable of type integers.
You can declare multiple variables at once in C programming. 
For example :
int a , age;

The size of int is usually 4 bytes ( 32 bits ). And it can take 2 pow32.

Float and double

float and double are used to hold real numbers.
float salary;
double price;
In C floating-points numbers can also be represent in exponentional.
For example :
float normalization_factor = 22.442e2

What's the difference between float and double?

The size of float ( single precision float data type) is 4 bytes. And double ( double float precision data type ) is 8 bytes.                                                                                                                                        

Char             

Keyword Char is used for declaring character types variables.
For example 
char test = 'h' ;
The size of the character variable  is 1 byte.                                                                                              

Void 

void is an incomplete type. It means "nothing" or " no type". You can think  of void as absent.
For example :
If a function is not returning anything, its return type should be void.
Note that you cannot create variable void type.

Short Long

If You need to used a large number,you can use a specifier long. Here's Show below 
long a ;
long long b ; 
long double c ;

Here, a and b can store integer values. And C can store floating point number.
If you are sure, only a small integer  ( -32 , 767 ,+32 , -767 range) will be used, you can use short.
short b ;

You can always check the size of variable using the size of() operator.


Signed and unsigned

In C sign and unsigned  are the modifiers. You can alter the data Storage of data type by using them.
For example :
unsigned int  x ;
int  y ;

Here, the variable can hold only zero and positive values because we have used unsigned modifiers.
 Considering the size of  int is 4 bytes, variable y can hold values from -2pow31 to -2pow31 -1, Where variable x can hold values from 0 to 2pow32 -1 

Other data_types in C programming are :
  • bool type
  • Enumerated type
  • complex type

Derived Datatypes 

Datatypes that are derived from fundamental datatypes are derived types.
For example :
array, pointer., function types, structures etc. 

Friday, March 27, 2020

What is Floating-point literal ?




 Floating-point literal                                                                                          A Floating-point is a numeric literal that has a fractional form or an exponent form.
For Example 
                      -2 ,  0.0000342 ,  -0.33E5 etc
Note  E-5 = 10 -5

Character   

A character literal is created by enclosing a single a single character inside quotation marks. 
For example : 'a' 'b' '3' 'D' '{' etc 

Escape Sequence

Sometimes, it is necessary to use characters that cannot be typed or has special meaning in C programming. For example : newline(enter) ,tab, question mark etc .
In order to use these characters, escape sequence are used. 

           Escape Sequence

|     \b                                 Backspace
|     \f                                  Form feed
|     \n                                 Newline
|     \r                                  Return
|     \t                                  Horizontal tab
|     \v                                 Vertical tab
|     \\                                 Backslash
|     \'                                  Single Quotation mark
|     \"                                 double Quotation mark 
|    \?                                 Question mark
|    \0                                 Null Character

For example : \n is used for newline . The backlash  \ causes escape from the normal way the characters are handled by the compiler.

Strings literals

A string literal is a sequence of character enclosed in double-quote.
For example 
"good"       \\ String constant 
" "              \\ Null string character 
"z"             \\ String constant having single character
"Earth is round \n"         \\ Print string with a newline

Constant

If you want to define a variable whose value cannot be  changed, you can use the constant keyword.
For example : const double PI =3.14;
Notice : PI  Symbolic constant; its value cannot be changed. 

Constant double PI = 3.14;   \\ Constant value 
PI = 2.4   \\ Error   

You can also define a constant using the define  preprocessor directive. 

You will learn about C Macros tutorial .

C Variables, Constants and literals


C Variables, Constants and literals 

In this you will learn about variables and rules of naming a variable. You will  learn about different literals in C programming and how to create constant.

Variables

In programming, a variable is a container ( storage data ) to hold data.
To indicate the storage area, each variable should be given a unique name ( identifier ). Variable names are just the symbolic representation of a memory location.
For example
                      int  Play_Score = 94;

Here, Play_score is a variable of  int type. Here, the variable is assigned an integer value 94.
The value of a variable can be changed, hence the name variable.

char ch = 'a';   // some code 
ch = '5';

Rules for for naming a variable 

  • A variable name only have letters ( both uppercase and lowercase), digits and underscore.
  • The first letter of variable should be an either letter or an underscore.
  • There is no rule on how long a variable name (identifier) can be. However you may run into  problems in some compilers if the variables name is longer than 31 character.
Note :    You should always give a meaningful names to variables. 
              For Example  : first_name is better variable name than first_name.

C is a strongly typed language. This means that the variable cannot be changed  once it is declared.
For example :
             int number =5;    // integer variable
             number =5.5;   // Error 
            double number;   // Error
   
Here, The type of number variable is int. You cannot assign a floating-point ( decimal ) value 5.5 to this variable. Also , you cannot redefine the data type of the variable to double. By the way, to store the decimal values in C, you need to declare its types to either double or float.

literals

literals are data used for representing fixed values, They can be used directly in the code.  For example 1, 2.3 'A' etc 

Here, 1, 2.3 and C are literals. Why ? You cannot assign different values to these terms.                      

  • Integers 

An integer is a numeric literal ( associated with numbers ) without any fractional and exponential part. There are three types of integer literal in C programming.

  • Decimal ( base 10 )                                                                                                                          
  • Octal base ( base 8 )
  • Hexadecimal ( base 16) 
For Example 
Decimal : 0, -9, 22 etc
Octal : 021, 077, 033 etc
Hexadecimal : 0x7f, 0x2a, 0x521 etc

In C programming octal starts with 0, and hexadecimal start with a 0x.   

                                                                    

Thursday, March 26, 2020

c program to display an integer value

C Program to print Integer value

#include 
int main() 
{   
    int number;
   
    printf("Enter an integer: "); //user value 
    
    // reads and stores input
    scanf("%d", &number);

    // displays user output
    printf("You entered: %d", number);
    
    return 0;
}

Output

Enter integer number = 45
You entered 45

How program works ?

  • In this program, an integer variable number is declared.
Int number;
  • Then. the user asked to enter an integer number, This number is stored in the number  variable.
printf("Enter an integer: ");
scanf("%d", &number);
  • Finally, the value stored in number is displayed on the screen using printf().
printf("You entered: %d ",number );

C Keywords and Identifier



C Keywords and Identifier 

In this tutorial, you will learn about keywords, reserved words in C programming that are part of the Programming. Also you will learn about identifiers and how to name them.

Character set

A character set is a set of alphabets, letter and some special character that are valid in C language. 

Alphabets  

Uppercase : A B C .............. X Y Z 
Lowercase : a b c   ..............  x y z 

( C Accepts both uppercase and lowercase  alphabets as variables and functions. )

Digits 

0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10  and so on.

Special Character's

Whenever you write any C program then it consists of different statements, Each C program is a set of statement and each statements is different C programming language. In programming each and every character is singe language.
    Types                                  Meanings                                                                
|                                               Tilde              |                                                                 
|       !                                Exclamation mark  |
|       #                                    Number sign     |                               
|       $                                     Dollar sign         |                                                               
|       %                                    Percentage        |                                                                 
|       ^                                        Caret               |                                                               
|       &                                    Ampersand       |                                                             
|       *                                       Asterisk             |                                                           
|       (                                 Left Parenthesis     |                                                     
|        )                               Right Parenthesis    |                                                         
|       _                                     Underscore        |
|       +                                      Plus sign            |
|       |                                      Vertical Bar         |
|        \                                     Black Slash        |
|       `                                      Apostrophe       |
|        -                                     Minus sign          |
|       =                                      Equal sign          |
|       {                                       Left brace          |
|       }                                      Right brace         | 
|       [                                      Left bracket        |
|       ]                                      Right bracket      |
|      :                                            Colon              |
|      "                                     Quotation mark    |
|      ;                                        Semi colon        |
|      <                              Open angle Bracket  |
|      >                              Close angle bracket  |
|      ?                                    Question mark      |
|      ,                                          Comma            |
|       .                                          Period              |       
|      /                                            Slash             |

White Space Characters 

Black space, Newline, Horizontal tab, Carriage, Return and form feed.



C Keywords

Keywords are predefined, reserved words are used in programming that have special meaning in the compiler. Keywords are part of syntax and they cannot be defined as an identifier.
For example
                        int money;
Here , int is a keyword that indicates money is a variable type of int ( Integer).

Keywords

auto  , double ,  int ,  struct ,  break , else , long , switch , case ,  enum , register , type define ,
char , extern , return , union , continue , for , signed , void , do , if , static , while , default ,
goto , sizeof , volatile ,  constant , float , short , unsigned.

All these keywords, their syntax, and application will be discussed in their respective topics. However, if you want a brief overview of these keywords without going further, List of all keywords in C programming.

C Identifiers 

Identities refer to name given to entities such as variables, functions, structure etc. Identifiers must be unique. They are created to give unique name to an entity to identify  its during  the execution of program. 
For Example

int money;
double account_balance;

Here, money and account_balance are identifiers.
Also remember, identifiers name must be different from keywords. You cann't be use int as identifiers because int is Keyword.

Rules for naming identifiers

  • A valid identifiers can have letters (Both Uppercase and lowercase letters), digits and underscores.
  • The first letter of an identifiers should be either letter or an underscore.
  • You cannot use keywords as identifiers.
  • There is no rule on how long identifiers can be. However, you may run into problems in some compilers if the identifiers is longer 31 Character.
You can chose any name as an identifier if you follow the above rule, however, give meaningful names to identifiers that make sense.

How to Become a Software Engineer if You Don't Have a Computer Science Degree

Technology


How to Become  a Software Engineer if You Don't Have a Computer Science Degree.

There isn't just one way to become an engineer anymore. These days you can attend a bootcamp, teach yourself, get a degree, or get an internship. I attend a bootcamp but I Still had to teach myself during it and just figure things out. 

My firs company hired me as an apprentice on a trial basis, After I Proved myself, they hired me as a full-time engineer. I'm now a  published author with one of the biggest engineering publishing companies  in the world. 

Meanwhile, my sister offered to work for free at a company for the first few weeks, just to prove she could do the work. This just goes to show that there are so many paths open to anyone willing to work hard and learn.

If you didn't get a CS degree, that's fine! There are so many other paths to becoming a software engineer. Let's look at a few of them here. 

Bootcamps


A legitimate bootcamp is a great investment in your career. When I graduated from college, I felt a little lost on what I wanted to do next.

I'd always loved coding but had never purchased it. My aunt knew that I was trying to figure out What I should do for my first real career steps, besides internships and part-time jobs in college, and sent me an email about coding bootcamps. This absolutely saved me. 

I had never even heard of a coding bootcamp before. I immediately starting doing a ton of research. It just seemed too good to be true. I read blog post from every single that had been to the bootcamp that I could find online. I read any review I could find. I started emailing students that attended the bootcamp and begging them to answer a few questions.

After I did my Research, I decided to apply to Dev  bootcamp. I was so nervous when I got in. I didn't have the money at the time so I had to take a loan from my parents. I couldn't even find a reasonably priced apartment in San Francisco, so I was Sleeping on a bunk bed with a roommate in a crowded house that had the vibe of Ron Weasley's house but without the magic.

It was the best thing I had ever done.

Fast Forward fiver year's and I'm a senior Software Engineer. I Speak at conferences all the time, Iv'e worked at big public companies such as Eventbrite and Pandora. I've been interviewed  for newspaper and television several times. I've been paid to consult at cutting edge companies, and I'm a published in the world. A coding bootcamp completely changed my life.

But it didn't work out for everyone that attend with me. I out started  out with 50-60 students in my cohort. By the time we graduated, about ten graduated with us. Some had staying behind a cohort to learn a little more. Some dropped out early, While they got a significant refund.
Otherwise decided that engineering wasn't for them partway thought the program when the financial loss was high. Other were asked o leave because they couldn't keep up.

A coding bootcamp in one of the largest pruchases you'll make in you'r life. Do your search. Many horror stories exist online of people who paid $10-20k only to find out the bootcamp was a scam or the teachers were inadequate.

A good bootcamp will start with an online phase first. where you'll learn from your home. It will teach  you the basics concepts of programming so that when you to the onsite portion of the program, you can focus on the tougher engineering with teacher around to answer your questions.

Make sure that you find a program that ask has a phase focused on the interviewing prep and that supplies you with a career team. This was one of the most beneficial parts of  my bootcamp. I got my first engineering job because the bootcamp helped me write out my linkedIn and make my profile stand out. My first company actually found me on linkedin -- I didn't even have to apply.

If you do decide to research coding bootcamp. I recommended you start with the following. Bootcamps: Hack Reactor, App Academy, and Hack bright.

Self-Learning   

If you have the time and can manage your own time well, this  option might be a great fit. It's definitely the toughest choice because you will need to keep to a schedule and stay motivated.

It's important to set goals to keep yourself on track. I recommend starting out with free resources before you commit to a more expensive paid course online. Try the free Code Camp responsive web design course to start out.

Once you've completed a few online coursed, start challenging yourself. Don't just keep following tutorials. Try to build something of your own.

Pick an idea that you're really excited about. If you're really passionate about what you're building, you'll be motivated to keep going. Do yo have any fun website ideas or command line projects you could try to build? Start small but keep increasing the complexity in your projects for you portfolio .

             
     

Recent Posts