//steps taken by a compiler to execute a C program /* 1. pre processing: i) comments removal ii) macros expansion iii) #files inclusion iv) conditional compilation 2. compilation: converts to assembly level instructions 3. assembling: converts to machine level instructions 4. linking: linker combine all machine level instructions to create an executable file that is .exe file*/ //to understand better how compiler works follow the below step /* A) execute "gcc -Wall -save-temps file_name.c" on vs code terminal u will get 4 extra files in explorer this files will show u how compiler works 1. file_name...
//basic syntax of a C program // a C program is made up of the collection of tokens // Token: smallest unit used in a C program is called token #include <stdio.h> int main () { int a // token (identifier) ; a = // token (operator) 100 ; printf ( "softwareharaish" //token (string literal) ) ; //token (symbol) return //token (keyword) 0 //token (constant) ; } // in the above c program I breaks the program into individual tokens // types of tokens i C program /* 1. keywords: reserved words which has a special meaning in c program () 2. identifiers: name of functions, variables ets to identifie (panctuators are not allowed to make id...
//variables in C //variable: A name given to a memory location is called variable //declaring variable: type variable_name; //rules for defining a variable in C /*1. can contain alphabets, digits and underscore(_) 2. a variable name can start with an alphabet and underscore only 3. can't start with a digit 4. whie space and reserved words are not allowed to give name of a variable */ //Data types in C /*1. basic data type: int, char, float, double 2. derived data type: this type of data types are created or derived by using basic data types array, pointers, structure, union 3. enumeration data type: emum 4. void data type: void */ #include <stdio.h> int main () { printf ( " %lu " , s...
Comments
Post a Comment