Posts

Difference between Structure and Class in C++

  Difference between Structure and Class in C++  Members of Structure are public by default and members of Class are private by default. Structures are value types and Classes are reference types (A variable of structure type contains the Structure's data but a class variable contains the reference of the data). Structures use stack allocation; Classes use heap allocation.  When deriving a struct from a class/struct, default access specifiers for base class/struct are public.

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 'C' Programming language is a Middle level programming language. It is widely used programming language from the day it is created. It is used in developing various operating systems as well as vast range of application.  A program is a set of instructions, given to the computer by user in user friendly format.  P rogram are written in human understandable format, that format is called as a programming language.   Then this source code will be converted to machine understandable code by the programming compiler. First C Program: // single line comment is written by using "//" /* Multi-line  comment is written in this format */ #include<stdio.h>  // header file which includes standard input/output functions int main()  // main function is the first function to be called in the program {      printf("Hello World\n");  // function to display the output      return 0;  // return 0 value on successful...

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̅)