Posts

pragma in c++

Why to use #pragma once  in program?   '#pragma' is a Preprocessor directive, which specifies how a compiler should process its input. The use of #pragma once can  reduce build times. Compiler will not open and read the file again after the first #include of the file in the translation unit. It's called the multiple-include optimization. The  intrinsic  pragma tells the compiler that a function has known behavior. The compiler may call the function and not replace the function call with inline instructions, if it will result in better performance .

Number System

 Important   Number System for computer are :- Decimal Number System (0-9) Binary Number System (0-1) Hexadecimal Number System (0-9, A-F) Octal Number System (0-7) 1.) Decimal Number System :        Base : 10       Values : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 2.) Binary Number System :        Base : 2       Values : 0, 1 3.) Hexadecimal Number System :        Base : 16       Values : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A(10), B(11), C(12), D(13), E(14), F(15)       4.) Octal Number System :        Base : 8       Values : 0, 1, 2, 3, 4, 5, 6, 7 Binary to Decimal Conversion: Binary (base-2) numbers use only two digits: 0 and 1. Decimal (base-10) numbers use ten digits: 0 through 9. The conversion process relies on the idea of place value , just like in decimal numbers. In decimal, each digit's position represents a power of 10 (e.g., in 1...

C Programming

C Programming  Introduction C is often called the “mother of all programming languages” because of its influence on modern languages like C++, Java, and Python. Developed by Dennis Ritchie in the early 1970s at Bell Labs, C remains a cornerstone for system programming, embedded systems, and performance-critical applications.  Why Learn C? Foundation for other languages: Many popular languages borrow syntax and concepts from C. Efficiency: C gives direct access to memory and hardware, making it ideal for embedded systems. Portability: Programs written in C can run on different machines with minimal changes. Control: Unlike high-level languages, C allows fine-grained control over system resources.  Key Features of C Procedural language: Focuses on functions and structured programming. Low-level access: Through pointers and direct memory manipulation. Rich library: Standard functions for input/output, string handling, and math. Fast compilation & execution: Suitable for ...

Skills for Embedded System Engineer/Embedded Software Developer

Important Skills for a good Embedded Software Developer Basic knowledge of electronic components & circuits. Experience with Micro-controllers.  Should be good in a programming Language most preferred in C. Schematic and Data Sheet understanding Device Driver Development Linux Operating System

E114 indentation is not a multiple of four (error) in python

An indentation error in Python occurs when the code is not properly aligned according to Python's indentation rules. Python uses indentation to define the structure of the code, such as blocks within loops, functions, conditionals, etc. Here are common causes and how to fix them: Common Causes of Indentation Errors: Inconsistent Indentation : Mixing tabs and spaces. Incorrect Block Indentation : Indenting the code block incorrectly relative to its control structure (e.g., a loop or function). Unintentional Indentation : Accidentally adding extra spaces or tabs. (E114) Th is error is raised when comment line has indentation which is not multiple of four. Example 1: def say_hello(): plainText = "hello!" # TxtText:markdown = "hello!" (this is wrong, it uses 5 spaces before comment) # TxtText:markdown = "hello!" (this is right, it uses 4 spaces before comment) Example 2: (Incorrect) def example_function(): print("This will cau...

Logic Gates

Image
  Logic Gates Logic gate is an electronic circuit having one or more inputs and only one output. These are the basic building blocks of a digital system. The input is related to the output based on a certain logic. The Basic logic gates are given below -  1. AND gate - For this logic gate output is "1" only when both input is "1", else "0". Output  = A . B 2. OR gate - For this logic gate output is "1", when any one of the input is "1", else "0". Output  = A+B 3. NOT gate - For this logic gate output is "1" when input is "0" and vice-versa. Output =  A̅ Derived logic gates are :-  1. NAND gate - Logic is working as NOT(AND). Output =  A . B 2. NOR gate - Logic is working as NOT(OR). Output = ( A+B ) 3. XOR gate - Output is "1" for different inputs and "0" for similar inputs. Output = (A. B̅  +  A̅.B) 4. XNOR gate - Logic is working as NOT(XOR). Output = ( A . B +  A̅ . B̅)