Wednesday, 29 September 2021

Stack vs. Heap

 

In programming language we need memory to store data.  The data stores in Stack and Heap memory according to local and global data.

What is Stack and Heap? Let us see.

Definition:

Stack:

It's a special region of your computer's memory that stores temporary variables created by each function (including the  main() function).

When to use stack?

·         You would use the stack if you know exactly how much data you need to allocate before compile time and it is not too big.

Heap:

The heap is a region of your computer's memory that is not managed automatically.

When to use Heap?

·         You would use the heap if you don't know exactly how much data you will need at run time or if you need to allocate a lot of data.

Which one faster?

The stack is faster because the access pattern makes it trivial to allocate and deallocate memory from it (a pointer/integer is simply incremented or decremented), while the heap has much more complex bookkeeping involved in an allocation or free.

The Heap

The heap is a region of your computer's memory that is not managed automatically for you, and is not as tightly managed by the CPU. It is a more free-floating region of memory (and is larger). To allocate memory on the heap, you must use malloc() or calloc(), which are built-in C functions. Once you have allocated memory on the heap, you are responsible for using free() to deallocate that memory once you don't need it any more. If you fail to do this, your program will have what is known as a memory leak. That is, memory on the heap will still be set aside (and won't be available to other processes). As we will see in the debugging section, there is a tool called valgrind that can help you detect memory leaks.

Unlike the stack, the heap does not have size restrictions on variable size (apart from the obvious physical limitations of your computer). Heap memory is slightly slower to be read from and written to, because one has to use pointers to access memory on the heap. We will talk about pointers shortly.

Unlike the stack, variables created on the heap are accessible by any function, anywhere in your program. Heap variables are essentially global in scope.

Examples

Here is a short program that creates its variables on the stack. It looks like the other programs we have seen so far.

#include <stdio.h>
 
double multiplyByTwo (double input) {
  double twice = input * 2.0;
  return twice;
}
 
int main (int argc, char *argv[])
{
  int age = 30;
  double salary = 12345.67;
  double myList[3] = {1.2, 2.3, 3.4};
 
  printf("double your salary is %.3f\n", multiplyByTwo(salary));
 
  return 0;
}
double your salary is 24691.340

Stack

Heap

·         It's a special region of your computer's memory that stores temporary variables created by each function (including the main() function).

·         The heap is a region of your computer's memory that is not managed automatically for you, and is not as tightly managed by the CPU.

·         Stack is used for static memory allocation

·         Heap is used for dynamic memory allocation

·         The stack is faster

·         Heap is slower

·         Stack stores local variables only

·         Heap stores global variable

  • space is managed efficiently by CPU, memory will not become fragmented

 

  • no guaranteed efficient use of space, memory may become fragmented over time as blocks of memory are allocated, then freed

 

  • limit on stack size (OS-dependent)

 

  • no limit on memory size

 

  • variables cannot be resized

 

  • variables can be resized using realloc()

 

  • when a function exits, all of its variables are popped off of the stack (and hence lost forever).

Heap variables are essentially global in scope.

  •  

 

So, both stack and heap have their own pros and cons. Which one be used in programming, it will depend on requirement of data and scope.

To learn more about Programming

Visit us @ tccicomputercoaching.com

Call us @ 98256 18292.

 

What you can learn during your vacation in during B.Tech in Computer?

 

B.Tech  Computer students try to learn so many languages during vacation.

Well, master the C Language. Instead of becoming Jack of all trades, be the master of one. 

In four years of engineering, you'll learn different programming languages but it'll immensely benefit you if you are the master of one i.e. you know everything about it. C is the best option to start learning Programming Languages. Because C is the base for all Programming Languages.

Computer Students will have courses on Data Structures and C++ in their curriculum. So, students can learn them during that time. If your C Programming Languages concepts are strong then you can easily clear Data Structure and C++. Specially, that will help to learn Data Structure.



C++ is Object Oriented Programming Language; if you are expert in this language then you can easily learn Java and Python.

HTML is very interesting Language, Learning of this language makes you feel  different. This language will help you to learn PHP, JavaScript etc. If you are strongly interested in this language then you can make your career in web designing.

You can learn also Basic of Networking. Then you can catch very well cyber security and hacking subjects.

You can learn all these subjects at one place only properly -TCCI Coaching Institute.

To know more in detail about What you can learn at TCCI?

Call us @ 9825618292.

Visit us @ tccicomputercoaching.com

What things computer students focused

 

tccicomputercoaching.com

The things that Computer Science Engineering students should focus on

What should understudies be truly concentrating on? Under studies who are in second or third year of their degree course at the present time. They'll put in a couple of years completing school, and a couple of years simply taking in the ropes at their first occupation. So it will truly be around 5 years before their profession truly begins. What will the product innovation world resemble around then, and what are the abilities that understudies can take a shot at obtaining right presently to guarantee that they are very much situated to flourish?



However, pause!
Computer Science Fundamentals: This will never leave mold, and truly, when I take a gander at understudies leaving our schools, this has all the earmarks of being a somewhat dismissed zone. Substantially a lot of accentuation on particular programming dialects, similar to C , C++ ,SQL , HTML and Data Structure. Whatever the future holds, you will be all around served by knowing the fundamental hypothesis of PC sciences

Presentation abilities: This isn't a software engineering aptitude, yet this is a standout amongst the most imperative abilities that software engineering understudies are absent. You should regard introduction as similarly vital, or more critical than your program, plan, and calculations. What's more, you should invest as much energy learning introduction (from books, in classes, and by and by)

Spotlight on your Goal: What do you figure understudies ought to centre around?

1. What are your interests?

Keep in mind Microsoft and Google authors chipped away at their interests and not what was most smoking thing occurring amid their opportunity.

"Adhere TO YOUR PLAN" regardless. Things will occur.

To read more visit us @ http://tccicomputercoaching.com/blog/

To connect with TCCI call @ 98256 18292.

What are the advantages of learning C++?tccicomputercoaching.com

 

C++ is the universal programming language. There's no single place where C++ doesn't work. It is not wrong if we say that "C++ is a huge, complex language." everything else looks trivial by comparison (except maybe garbage collection). you will learn a fair amount about compilers.

C++ is the object oriented language. If you learn C++ then you will have clear concepts of OOPs. Then you can learn other languages very well.



Multiple inheritance, Virtual methods  teaches you about how compilers lay out data in memory.

Scopes, Reference counting teaches you about stack and heap memory, memory management and resource management.

Templates                   

Teaches you about computer architecture and the costs of redirections on performance, and therefore why you use templates instead of virtual classes that wrap around native types and/or pointers.

Pointers and References, Closures and Captures teaches a thing or two about optimizations. Closures and captures -- how they are syntactic sugar for basically a heap-allocated class with a bunch of properties and a method.

To know more about C++ Language

Call us @ 98256 18292.

Visit us @ http://tccicompuetrcoaching.com

 

 

How do you start programming Java?-tccicomputercoaching.com

 

Most of us pick Java as our first programming language as it’s easy-to-learn. With an English-like syntax, Java could be learnt in a short span of time which in turn help you build useful applications.



If Java is the first programming language to learn then start from basic of programming language like compiler, interpreter, variable, data-type, control statements, loop etc.

But if you are aware of C, C++ then great!!!

You can now easily learn Java in very short time-period. All Basic concepts should be clear. Then you can start from OOPS concepts like class-object, polymorphism, inheritance, interface, overriding, package etc.

Once you are clear with your basics, you are all ready to go for an advance level!

To learn Java call us @ 98256 18292.

Visit us @ http://tccicomputercoaching.com

Monday, 27 September 2021

troducing Courses At TCCI

 

Build your skills with in-depth courses for any level, taught by TCCI experts. TCCI offers various courses to the school students , college students , industry people , House-wives , senior citizens or any person.



Enrol to learn on-demand course Online or Offline as per your comfort at TCCI.

Class-timing flexible as per student and faculty time.

 

Call us @ 9825618292                                      

Visit us @ http://tccicomputercoaching.com/course/

Thursday, 23 September 2021

What is macro in Excel? tccicomputercoaching.com

 

macro can be defined as the recording of a series of tasks. When used right, macros can save you hours by automating simple, repetitive tasks. Marcos in Excel is written in Excel VBA (Visual Basic for Applications).



Users can create macros for their customized repetitive functions and instructions. Macros can be either written or recorded depending on the user.

Steps to record simple Macro:
1. Open View Menu in Excel File

2. Click record button, and start which function you want to do store .

3. There will display record Button.

4. After completing task, stop record button.

5. Now when you want to implement the task, go to view menu and click on macro name.

TCCI teach Basic Computer course which include Excel, Word, Power Point etc...

To learn more about Macro in Excel at TCCI Computer Coaching Institute.

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com/computer-course/        

Python Loops-tccicomputercoaching.com

 

Python programming language provides following types of loops to handle looping requirements.

 


Sr.No.

Loop Type & Description

1

while loop

Repeats a statement or group of statements while a given condition is TRUE. It tests the condition before executing the loop body.

2

for loop

Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.

3

nested loops

You can use one or more loop inside any another while, for or do..while loop.

3 sections of Loop:

1. Initialization:

i=1

2. Codition

i<=10 or i<11

3. Updation(increment/decrement)

i=i+1 or i+=1

 

 

Python has two primitive loop commands:

  • while loops
  • for loops

To learn Python Programming Language at TCCI, Ahmedabad.

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com/course/

Get Basic Knowledge of Civil Engineering at TCCI-tccicomputercoaching.com

 

Civil engineers make, enhance and ensure nature in which we live. They design, outline and supervise development and upkeep of building structures and framework, for example, streets, railroads, air terminals, spans, harbors, dams, water system ventures, control plants, and water and sewerage frameworks.



CIVIL ENGINEER should have Basic Requirements to become successful.

1. Tests of Building Materials:

·         A good civil engineer should have proper knowledge of different tests of building materials.       Some important tests are listed below.

·         Concrete TestSlump test, compression test, split tensile test, soundness etc.

·         Soil Test: Core cutter test, compaction test, sand replacement test, triaxial test, consolidation     test etc.

·         Bitumen Test: Ductility test, softening point test, gravity test, penetration test etc.

2. He / she should be aware of uses Of Surveying Instruments:

·         Usages of surveying instruments like the total station, theodolite etc. 

3. Drawing and Design:

·         Drawing and design are the primary keys of an ongoing project. 

4. Estimation and Bills:

·         Estimation and bills should be prepared by a civil engineer in a construction project.

5. CLEAR COVER TO MAIN REINFORCEMENT:

6. WEIGHT OF ROD PER METER LENGTH:

7. STANDARD CONVERSION FACTORS

8. MATERIAL CALCULATION:

9. UNIT WEIGHT:

TCCI have Best Qualified Faculty who provide all such Basic Knowledge to civil engineering students. TCCI is located in Bopal and satellite in Ahmedabad. Faculty teach at home also. Lectures are conducted as per student flexible time.

Call us @ 9825618292                                      

Visit us @ http://tccicomputercoaching.com/course/