#pragma startup and #pragma exit directive in c Programming Language Syntax : startup pragma #pragma startup <function_name> [priority] startup pragma allow the program to specify function(s) that should be called upon program startup Function is called before main(). Syntax : exit pragma #pragma exit <function_name> [priority] exit pragma allow the program to specify function(s) that(…)
#pragma directive in C : Implementation-specific directives
#pragma directive in C : Implementation-specific directives Syntax: #pragma <directive name> Explanation : With #pragma, Turbo C++ can define whatever directives it desires without interfering with other compilers that support #pragma. If the compiler doesn’t recognize <directive name>, it ignores the #pragma directive without an error or warning message. Turbo C++ supports the following #pragma directives: #pragma(…)
#undef : Undefine Macro (Preprocessor Directive in C Programming)
#undef : Preprocessor Directive in C Programming Syntax: #undef <identifier> #undef : Undefines a symbol Undefines a symbol specified by <identifier> which was previously defined with a #define directive. #undef Directive is used to undefine any Macro Symbol. #undef can undefine only “User Defined” Macro’s. #undef cannot undefine “Global Macro Identifiers“. #undef is used where we(…)
#ifndef statement : Conditional Compilation Directives (C Preprocessor)
#ifndef statement : Conditional Compilation Directives (C Preprocessor) What it does ? These Conditional Compilation Directives allow us to include certain portion of the code depending upon the output of constant expression Block is Called as Conditional Group Syntax : #ifndef MACRONAME Statement_block; #endif Explanation : If the MACRONAME specified after #ifndef is not defined(…)
#ifdef statement : Conditional Compilation Directives (C Preprocessor)
#ifdef statement : Conditional Compilation Directives (C Preprocessor) What it does ? These Conditional Compilation Directives allow us to include certain portion of the code depending upon the output of constant expression Block is Called as Conditional Group Syntax : #ifdef MACRONAME Statement_block; #endif Explanation : If the MACRONAME specified after #ifdef is defined previously(…)
#elif statement : Conditional Compilation Directives (C Preprocessor)
#elif statement : Conditional Compilation Directives (C Preprocessor) What it does ? These Conditional Compilation Directives allow us to include certain portion of the code depending upon the output of constant expression Syntax : #if Expression1 Statement_block 1; #elif Expression2 Statement_block 2; #elif Expression3 Statement_block 3; #else Statement_block 4; #endif Explanation : Expression allows only(…)
#else statement : Conditional Compilation Directives (C Preprocessor)
#else statement : Conditional Compilation Directives (C Preprocessor) What it does ? These Conditional Compilation Directives allow us to include certain portion of the code depending upon the output of constant expression Syntax : #include<stdio.h> #define NUM 11 void main() { #if((NUM%2)==0) printf(“\nNumber is Even”); #else printf(“\nNumber is Odd”); #endif } Explanation : Expression allows (…)
#if statement : Conditional Compilation Directives (C Preprocessor)
#if statement : Conditional Compilation Directives (C Preprocessor) What #if statement do ? These Conditional Compilation Directives allow us to include certain portion of the code depending upon the output of constant expression Syntax : #if Expression Statement 1 Statement 2 . . Statement n #endif Explanation : #if Statement Expression allows only constant expression(…)
Difference between macro and function in C Programming
Difference between macro and function No Macro Function 1 Macro is Preprocessed Function is Compiled 2 No Type Checking Type Checking is Done 3 Code Length Increases Code Length remains Same 4 Use of macro can lead to side effect No side Effect - 5 Speed of Execution is Faster Speed of Execution is Slower(…)
Fgetc function : Get character from stream (stdio.h)
Fgetc function : get character from stream What this function does ? Header File : Stdio.h fgetc gets a character from a stream fgetc returns the next character on the named input stream. It is a function not macro (getc is a macro) Return Value : Event Return Value On Error Returns Character read after(…)